【发布时间】:2018-10-23 16:28:56
【问题描述】:
我收到此错误:
#[derive(Insertable, Queryable, Identifiable, Debug, PartialEq)]
^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `std::string::String`
当我尝试编译这个struct:
#[derive(Insertable, Queryable, Identifiable, Debug, PartialEq)]
#[table_name = "example_table"]
pub struct SigninLog {
pub id: i32,
pub user_group: UserRoleEnum,
pub created_at: Option<SystemTime>,
pub optional_data: Option<String>
}
是因为它包含自定义enum 或Option<String>?如果这是问题,我该如何解决?
【问题讨论】:
-
请查看如何提供minimal reproducible example。对于柴油相关的问题,see its specific MCVE guidance。提供 schema 非常重要。你还没有定义
UserRoleEnum是什么,也没有定义SystemTime来自哪里。完全有可能甚至不需要这些字段,这是使其最小化的一部分。 -
您解决了这个问题吗? @tandry syawaludin
标签: rust rust-diesel