Macro rbatis::pysql_select_page
source · macro_rules! pysql_select_page { ($fn_name:ident($($param_key:ident:$param_type:ty$(,)?)*) -> $table:ty => $py_file:expr) => { ... }; }
Expand description
impl py_sql select page.
you must deal with 3 param: (do_count:bool,page_no:u64,page_size:u64)
you must deal with sql:
return Vec
you can see ${page_no} = (page_no -1) * page_size; you can see ${page_size} = page_size;
just like this example:
`select * from activity where delete_flag = 0`
if name != '':
` and name=#{name}`
if !ids.is_empty():
` and id in `
${ids.sql()}
#[derive(serde::Serialize, serde::Deserialize)]
pub struct MockTable{}
rbatis::pysql_select_page!(pysql_select_page(name:&str) -> MockTable =>
r#"`select `
if do_count == true:
` count(1) as count `
if do_count == false:
` * `
`from activity where delete_flag = 0`
if name != '':
` and name=#{name}`
` limit ${page_no},${page_size}`
"#);