通过 diesel_cli_ext 生成 Diesel 模型时是否可以添加派生注释?
Is it possible to add derive annotations when generating Diesel models via diesel_cli_ext?
我正在使用 diesel_cli_ext 生成 Rust 模型代码:
diesel_ext --schema-file src/model/diesel/dolphin/dolphin_schema.rs --model > src/model/diesel/dolphin/dolphin_models.rs
生成的模型如下所示:
#[derive(Queryable, Debug)]
pub struct AdminUser {
pub id: i64,
pub nickname: Option<String>,
pub avatar_url: Option<String>,
pub phone: Option<String>,
pub updated_time: Option<i64>,
pub created_time: Option<i64>,
pub salt: Option<String>,
pub pwd: Option<String>,
pub sex: Option<i32>,
pub level_type: Option<String>,
pub phone_region: Option<String>,
pub country_code: Option<i32>,
pub user_status: Option<String>,
}
是否可以在生成模型时添加更多的注释?我想要这些派生:
#[derive(Serialize, Queryable, Deserialize, Default)]
一直在自己添加,但是下一代覆盖了之前的修改
阅读 "how to use" documentation 显示命令行选项允许您修改 derive
s:
-d, --derive DERIVES
set struct derives
我正在使用 diesel_cli_ext 生成 Rust 模型代码:
diesel_ext --schema-file src/model/diesel/dolphin/dolphin_schema.rs --model > src/model/diesel/dolphin/dolphin_models.rs
生成的模型如下所示:
#[derive(Queryable, Debug)]
pub struct AdminUser {
pub id: i64,
pub nickname: Option<String>,
pub avatar_url: Option<String>,
pub phone: Option<String>,
pub updated_time: Option<i64>,
pub created_time: Option<i64>,
pub salt: Option<String>,
pub pwd: Option<String>,
pub sex: Option<i32>,
pub level_type: Option<String>,
pub phone_region: Option<String>,
pub country_code: Option<i32>,
pub user_status: Option<String>,
}
是否可以在生成模型时添加更多的注释?我想要这些派生:
#[derive(Serialize, Queryable, Deserialize, Default)]
一直在自己添加,但是下一代覆盖了之前的修改
阅读 "how to use" documentation 显示命令行选项允许您修改 derive
s:
-d, --derive DERIVES
set struct derives