【发布时间】:2022-01-21 09:05:33
【问题描述】:
我现在正在使用此命令在 rust 柴油中生成架构:
diesel --database-url postgres://postgres:kZLxttcZSN@127.0.0.1:5432/rhythm \
migration run --config-file="${CURRENT_DIR}"/diesel-rhythm.toml
这是 toml 配置:
[print_schema]
file = "src/model/diesel/rhythm/rhythm_schema.rs"
# This will cause only the users and posts tables to be output
filter = { only_tables = ["favorites", "songs", "playlist"] }
是否可以让柴油汽车生成模型实体?实体可能如下所示:
#[derive( Serialize, Queryable, Deserialize,Default)]
pub struct Music {
pub id: i64,
pub name: String,
pub source_id: String
}
现在我通过句柄编写实体。我应该怎么做才能让它由柴油 cli 生成,我阅读了文档并没有找到任何有用的配置。
【问题讨论】:
-
您的意思是从 db.table 定义中生成
Music模型吗? -
是的,这就是我的意思,按句柄写模型很无聊。 @NjugunaMureithi
标签: rust rust-diesel