the trait `diesel::Expression` is not implemented for `bigdecimal::BigDecimal`

前端 未结 2 2074
广开言路
广开言路 2021-01-12 15:22

I am trying to create a struct that I can use in diesel for insertion. Specifically I am making the struct Insertable. On compile I get this error.

I have a struct

2条回答
  •  心在旅途
    2021-01-12 16:07

    You might reach this question by searching an error message that is really similar:

    the trait `diesel::Expression` is not implemented for `(schema::..., schema::..., schema::...)`
    

    This is just a reminder to count the number of columns you have in the table!{} macro because you might be reaching the default 32 column limit.

    According to the Diesel changelog you should use the following features if you use more than the default 32 columns.

    64 columns (Cargo.toml)

    diesel = { version = "1.4", features = [..., "64-column-tables"] }
    

    128 columns (Cargo.toml):

    diesel = { version = "1.4", features = [..., "128-column-tables"] }
    

    Using more columns is not possible and might be a hint that the table design is not ideal (See: https://github.com/diesel-rs/diesel/issues/2312#issuecomment-591623303).

提交回复
热议问题