Electron100 / butane

An ORM for Rust with a focus on simplicity and on writing Rust, not SQL
Apache License 2.0
93 stars 13 forks source link

datetime example #6

Closed ieow closed 3 years ago

ieow commented 3 years ago

Hi, is there any datetime example ?

use chrono::NaiveDateTime::DateTime;

#[model]
#[derive(Debug, Serialize, Deserialize, Clone, Default )]
pub struct Voucher {
    pub createAt : DateTime<Local>,
    pub optionAt : Option<DateTime<Local>>,
}

I try code struct above, it complain about error[E0277]: the trait boundchrono::DateTime: ToSqlis not satisfied

using crate : butane 0.3.0 chrono 0.4.19

any pointer would be great help!

ieow commented 3 years ago

Just found example here https://github.com/Electron100/butane/blob/master/butane/tests/common/blog.rs