I'm getting the following error when trying to compile my rust diesel project despite the diesel docs showing that this trait is implemented
the trait bound
DateTime<Utc>: FromSql<diesel::sql_types::Timestamptz, Pg>
is not satisfied
My schema.rs
pub mod offers {
diesel::table! {
offers.offers (id) {
id -> Int4,
#[max_length = 255]
offername -> Varchar,
#[max_length = 255]
offertypeid -> Nullable<Varchar>,
startdate -> Nullable<Timestamptz>,
enddate -> Nullable<Timestamptz>,
frequency -> Nullable<Int4>,
#[max_length = 255]
createdby -> Nullable<Varchar>,
createdAt -> Nullable<Timestamptz>
}
}
}
Here is my models.rs:
use diesel::prelude::*;
use chrono::{DateTime, Utc};
use crate::schema::offers::offers as offerTable;
#[derive(Queryable, Selectable)]
#[diesel(table_name = offerTable)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct Offer {
pub id: i32,
pub enddate: Option<DateTime<Utc>>,
pub createdAt: Option<DateTime<Utc>>,
pub createdby: Option<String>,
pub frequency: Option<i32>,
pub offername: String,
pub startdate: Option<DateTime<Utc>> <--- ERROR FOR THIS LINE
}
In the docs for diesel here is shows that this mapping should work and I haven't been able to figure out why it's not working