氪-Kr
[氪-Kr] Rust开发工具包
安装
cargo add kr
kr-core
核心 Crate
功能
- AES
- Hash
- 时间格式化
- 基于Redis的分布式锁
- 基于
bb8 的Redis异步Manager
- API Code 宏定义:
define_ok! 和 define_error_codes!
⚠️ aes 相关功能依赖 openssl
kr-macros
宏定义 Crate
派生宏:Model
#[derive(Model)]
#[partial(UserLite !(email, phone))] #[partial(UserBrief (id, name), derive(Copy, Debug))] pub struct User {
pub id: i64,
pub name: String,
pub email: String,
pub phone: String,
pub created_at: String,
}
#[derive(sqlx::FromRow)]
pub struct UserLite {
pub id: i64,
pub name: String,
pub created_at: String,
}
#[derive(Copy, Debug, sqlx::FromRow)]
pub struct UserBrief {
pub id: i64,
pub name: String,
}
👉 具体使用可以参考 rnx
Enjoy 😊