[−][src]Trait rbatis::crud::CRUDEnable
DB Table model trait
Associated Types
type IdType: Send + Sync + DeserializeOwned + Serialize + Display
your table id type,for example: IdType = String IdType = i32
Provided methods
fn table_name() -> String
get table name,default is type name for snake name
for Example: struct BizActivity{} => "biz_activity" also. you can overwrite this method return ture name
impl CRUDEnable for BizActivity{ table_name() -> String{ "biz_activity".to_string() } }
fn table_fields() -> String
get table fields string
for Example: "create_time,delete_flag,h5_banner_img,h5_link,id,name,pc_banner_img,pc_link,remark,sort,status,version"
you also can impl this method for static string
fn make_field_value_map<C>(
db_type: &DriverType,
arg: &C
) -> Result<Map<String, Value>> where
C: CRUDEnable,
db_type: &DriverType,
arg: &C
) -> Result<Map<String, Value>> where
C: CRUDEnable,
make an Map<table_field,value>
fn make_fields(map: &Map<String, Value>) -> Result<String>
make fields
fn make_sql_arg(
index: &mut usize,
db_type: &DriverType,
map: &Map<String, Value>
) -> Result<(String, Vec<Value>)>
index: &mut usize,
db_type: &DriverType,
map: &Map<String, Value>
) -> Result<(String, Vec<Value>)>
return (sql,args)
Implementations on Foreign Types
impl<T> CRUDEnable for Option<T> where
T: CRUDEnable,
[src]
T: CRUDEnable,
type IdType = T::IdType
fn table_name() -> String
[src]
Bean's table name
fn table_fields() -> String
[src]
Bean's table fields
fn make_field_value_map<C>(
db_type: &DriverType,
arg: &C
) -> Result<Map<String, Value>> where
C: CRUDEnable,
[src]
db_type: &DriverType,
arg: &C
) -> Result<Map<String, Value>> where
C: CRUDEnable,
fn make_fields(map: &Map<String, Value>) -> Result<String>
[src]
fn make_sql_arg(
index: &mut usize,
db_type: &DriverType,
map: &Map<String, Value>
) -> Result<(String, Vec<Value>)>
[src]
index: &mut usize,
db_type: &DriverType,
map: &Map<String, Value>
) -> Result<(String, Vec<Value>)>
return sql,args