I started with diesel and rocket in Rust and have a problem with inserting floating values to the database. My struct looks like:
#[derive(Serialize, Deserialize, Insertable)]
#[table_name = "database"]
pub struct New_Data{
pub data1: f64,
pub data2: f64,
pub data3: f64,
}
and I get this error: the trait bound f64: diesel::Expression
is not satisfied
label: the trait diesel::Expression
is not implemented for f64
,
note: required because of the requirements on the impl of diesel::expression::AsExpression<diesel::sql_types::Numeric>
for f64
I've read that diesel kinda uses its own data/SQL types but I have no idea how to declare a Float. I also tried to use diesel::sql_types::Float with a similar error message.