[−][src]Trait rbatis::crud::CRUDEnable
DB Table model trait
if use #[crud_enable] impl Table struct, for example: #[crud_enable(id_name:"id"|id_type:"String"|table_name:"biz_activity"|table_columns:"id,name,version,delete_flag"|formats_pg:"id:{}::uuid")]
if use impl CRUDEnable for Table struct, you must impl IdType and id_name() method!
Associated Types
type IdType: Send + Sync + Serialize + Display
[src]
your table id type,for example: IdType = String IdType = i32
Provided methods
pub fn id_name() -> String
[src]
table id column
pub fn table_name() -> String
[src]
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() } }
pub fn table_columns() -> String
[src]
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
pub fn make_column_value_map(
&self,
db_type: &DriverType
) -> Result<Map<String, Value>>
[src]
&self,
db_type: &DriverType
) -> Result<Map<String, Value>>
make an Map<table_column,value> TODO macro driver auto create this methods
pub fn do_format_column(
driver_type: &DriverType,
column: &str,
data: String
) -> String
[src]
driver_type: &DriverType,
column: &str,
data: String
) -> String
format column
pub fn make_value_sql_arg(
&self,
db_type: &DriverType,
index: &mut usize
) -> Result<(String, Vec<Value>)>
[src]
&self,
db_type: &DriverType,
index: &mut usize
) -> Result<(String, Vec<Value>)>
return (value sql,args)
pub fn formats(driver_type: &DriverType) -> HashMap<String, String>
[src]
return cast chain column:format_str for example: HashMap<"id",“{}::uuid”>
Implementations on Foreign Types
impl<T> CRUDEnable for Option<T> where
T: CRUDEnable,
[src]
T: CRUDEnable,
type IdType = T::IdType
pub fn table_name() -> String
[src]
pub fn table_columns() -> String
[src]
pub fn formats(driver_type: &DriverType) -> HashMap<String, String>
[src]
pub fn make_column_value_map(
&self,
db_type: &DriverType
) -> Result<Map<String, Value>>
[src]
&self,
db_type: &DriverType
) -> Result<Map<String, Value>>
pub fn make_value_sql_arg(
&self,
db_type: &DriverType,
index: &mut usize
) -> Result<(String, Vec<Value>)>
[src]
&self,
db_type: &DriverType,
index: &mut usize
) -> Result<(String, Vec<Value>)>