when I added the Selectable
in rust diesel diesel = { version = "1.4.8", features = ["postgres","64-column-tables","chrono","serde_json"] }
code like this:
#[derive(Insertable,Queryable,QueryableByName,Debug,Serialize,Deserialize,Default,Clone,Selectable)]
#[table_name = "bill_record"]
pub struct BillRecord {
pub id: i64,
pub created_time: i64,
pub updated_time: i64,
pub deleted: i32,
pub user_id: i64,
pub bill_book_id: i64,
pub remark: Option<String>,
pub amount: i64,
pub bill_book_contents_id: i64,
pub account_id: i32,
}
the compiler shows error cannot find derive macro Selectable in this scope
. I have tried to add the micro driver like this in main.rs
:
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate diesel_drivers;
could not fixed this error, I also read the diesel source code and found the Selectable come from diesel_drivers. why could not fixed this problem even add the drivers macro? what should I do to fix it? I also tried to add use diesel::*;
in the model, still not work.
Please try rectifying the typo - it is "derives" instead of "drivers"
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate diesel_derives;
https://docs.diesel.rs/master/diesel_derives/derive.Selectable.html