Attribute Macro rbatis::py_sql [−][src]
#[py_sql]
Expand description
py sql create macro,this macro use RB.py_fetch and RB.py_exec
lazy_static! { pub static ref RB: Rbatis = Rbatis::new(); }
#[py_sql(RB,“select * from biz_activity where delete_flag = 0”)]
async fn py_select_page(page_req: &PageRequest, name: &str) -> Page
or more example:
#[py_sql(“
SELECT * FROM biz_activity
if name != null:
AND delete_flag = #{del}
AND version = 1
if age!=1:
AND version = 1
AND version = 1
AND a = 0
AND version = 1
and id in (
trim ‘,’: for item in ids:
#{item},
)
and id in (
trim ‘,’: for index,item in ids:
#{item},
)
trim ‘AND’:
AND delete_flag = #{del2}
choose:
when age==27:
AND age = 27
otherwise:
AND age = 0
WHERE id = ‘2’“)]
pub async fn py_select_rb(rbatis: &Rbatis, name: &str) -> Option