Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Releases: rbatis/rbatis

v4.6.12

12 Oct 14:22

Choose a tag to compare

what changes?

 #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq)]
struct MockTable {
        pub id: Option<String>,
        pub name: Option<String>,
        pub status: Option<i32>
}
crud!(MockTable{});
let r = MockTable::update_by_map(rb, &table, value!{"id":"1", "column": ["name", "status"]}).await;
  • impl crud! for select target columns
 #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq)]
struct MockTable {
        pub id: Option<String>,
        pub name: Option<String>,
        pub status: Option<i32>
}
crud!(MockTable{});
let tables = MockTable::select_by_map(rb,value!{"id":"1", "column": ["id", "name"]}).await?; 

v4.6.9

11 Oct 17:47

Choose a tag to compare

  • this is an doc fix version
  • merge #586

v4.6.8

02 Jul 10:43

Choose a tag to compare

add page method:

/// create Vec<PageRequest> from (total: u64, page_size: u64)
    pub fn make_page_requests(total: u64, page_size: u64) -> Vec<PageRequest> {
        let mut result = vec![];
        let pages = PageRequest::new(1, page_size).set_total(total).pages();
        for idx in 0..pages {
            let current_page = PageRequest::new(idx + 1, page_size).set_total(total);
            result.push(current_page);
        }
        result
    }

v4.6.7

01 Jun 15:12

Choose a tag to compare

  • fix PageIntercept remove order by sql when run count sql

v4.6.5

31 May 07:19

Choose a tag to compare

  • crud macro *_by_map method will be skip null for example value!{ "name": null }

v4.6.4

29 May 07:49

Choose a tag to compare

  • page intercept will be remove order by when run count sql

v4.6.3

27 May 15:37

Choose a tag to compare

  • in () sql will be return default result

v4.6.2

25 May 13:05

Choose a tag to compare

  • fix crud macro select_by_map(&rb, value!{"id": &[]}).await; if is select empty array ,will be return empty vec result.

v4.6.1

23 May 10:23

Choose a tag to compare

  • fix check empty arg

v4.6.0

22 May 13:15

Choose a tag to compare

what changes?

  • rbatis_codgen add contains starts_with ends_with
  • crud macro remove *_by_column methods ( use *by_map replace)
  • crud macro update (all use of *by_map) for example
#[tokio::main]
pub async fn main() {
    let rb = RBatis::new();
    rb.init(rbdc_sqlite::driver::SqliteDriver {}, "sqlite://target/sqlite.db").unwrap();
    
let table = Activity {
        id: Some("2".into()),
        name: Some("2".into()),
        pc_link: Some("2".into()),
        h5_link: Some("2".into()),
        pc_banner_img: None,
        h5_banner_img: None,
        sort: Some("2".to_string()),
        status: Some(2),
        remark: Some("2".into()),
        create_time: Some(DateTime::now()),
        version: Some(1),
        delete_flag: Some(1),
    };
    let tables = [table.clone(), {
        let mut t3 = table.clone();
        t3.id = "3".to_string().into();
        t3
    }];

    let data = Activity::insert(&rb, &table).await;
    println!("insert = {}", json!(data));

    let data = Activity::insert_batch(&rb, &tables, 10).await;
    println!("insert_batch = {}", json!(data));

    let data = Activity::update_by_map(&rb, &table, value!{ "id": "1" }).await;
    println!("update_by_map = {}", json!(data));

    let data = Activity::select_by_map(&rb, value!{"id":"2","name":"2"}).await;
    println!("select_by_map = {}", json!(data));

    let data = Activity::select_by_map(&rb, value!{"id":"2","name like ":"%2"}).await;
    println!("select_by_map like {}", json!(data));

    let data = Activity::select_by_map(&rb, value!{"id > ":"2"}).await;
    println!("select_by_map > {}", json!(data));

    let data = Activity::select_by_map(&rb, value!{"id": &["1", "2", "3"]}).await;
    println!("select_by_map in {}", json!(data));

    let data = Activity::delete_by_map(&rb, value!{"id": &["1", "2", "3"]}).await;
    println!("delete_by_map = {}", json!(data));
}