Postgresql 柴油机(锈库)不';I don’我不允许发表更新声明
结构是Postgresql 柴油机(锈库)不';I don’我不允许发表更新声明,postgresql,rust,Postgresql,Rust,结构是 #[derive(Identifiable, Queryable, Debug)] #[table_name = "users"] pub struct QueryableUser { pub id: i32, pub username: String, pub password: String, pub sex: bool, pub profile: Option<String>, pub birth: chrono::Nai
#[derive(Identifiable, Queryable, Debug)]
#[table_name = "users"]
pub struct QueryableUser {
pub id: i32,
pub username: String,
pub password: String,
pub sex: bool,
pub profile: Option<String>,
pub birth: chrono::NaiveDate,
}
它给了我这个错误
error[E0277]: the trait bound `user::QueryableUser: diesel::Identifiable` is not satisfied
--> src\message_handler\set_profile.rs:36:13
|
36 | diesel::update(user).set(profile.eq(None));
| ^^^^^^^^^^^^^^ the trait `diesel::Identifiable` is not implemented for `user::QueryableUser`
|
= help: the following implementations were found:
<&'ident user::QueryableUser as diesel::Identifiable>
= note: required because of the requirements on the impl of `diesel::query_builder::IntoUpdateTarget` for `user::QueryableUser`
= note: required by `diesel::update`
error[E0277]:未满足特性绑定'user::QueryableUser:diesel::identification'
-->src\message\u handler\set\u profile.rs:36:13
|
36 |柴油机::更新(用户).set(profile.eq(无));
|^^^^^^^^^^^^^^^^^^^^^^^^^未为“user::QueryableUser”实现特征“diesel::identificatable”`
|
=帮助:找到了以下实现:
我忘了在diesel::update(user).set(profile.eq(None))中借用user代码>
error[E0277]: the trait bound `user::QueryableUser: diesel::Identifiable` is not satisfied
--> src\message_handler\set_profile.rs:36:13
|
36 | diesel::update(user).set(profile.eq(None));
| ^^^^^^^^^^^^^^ the trait `diesel::Identifiable` is not implemented for `user::QueryableUser`
|
= help: the following implementations were found:
<&'ident user::QueryableUser as diesel::Identifiable>
= note: required because of the requirements on the impl of `diesel::query_builder::IntoUpdateTarget` for `user::QueryableUser`
= note: required by `diesel::update`