小编twi*_*clo的帖子

mysql - 特性 `diesel::Expression` 没有为 `f64` 实现

我正在尝试使用柴油和 mysql 建立模型。我的第一个模型编译没有问题,但是当我的第二个模型(用于将新条目插入到我的数据库中的模型)尝试推导时,Insertable我收到了大量错误,指出diesel can't use f64, u16, 或NaiveDateTime

error[E0277]: the trait bound `u16: diesel::Expression` is not satisfied
  --> src/models.rs:26:10
   |
26 | #[derive(Insertable, Debug, Queryable)]
   |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u16`
   |
   = note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::sql_types::Unsigned<diesel::sql_types::Integer>>` for `u16`
   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `chrono::naive::datetime::NaiveDateTime: diesel::Expression` …
Run Code Online (Sandbox Code Playgroud)

mysql rust rust-diesel

5
推荐指数
1
解决办法
1166
查看次数

标签 统计

mysql ×1

rust ×1

rust-diesel ×1