rbatis

Rust Compile Time ORM robustness,async, pure Rust Dynamic SQL

APACHE-2.0 License

Downloads
1.1M
Stars
2.3K
Committers
25

Bot releases are hidden (Show)

rbatis - v4.5.29 Latest Release

Published by zhuxiujia 3 months ago

what changes?

  • Re implement the insert batch and combine it with the bind instruction in py_sql
rbatis - v4.5.28

Published by zhuxiujia 4 months ago

what changes?

  • fix #532 Fix insert_batch skipping Options that are None in the first item of the batch
  • insert/insert_batch performance optimization
rbatis - v4.5.26

Published by zhuxiujia 4 months ago

what changes?

  • fix for #531 support insert batch when insert values have null value(Based on the first insert table column/values)
rbatis - v4.5.24

Published by zhuxiujia 5 months ago

what changes?

  • update table_util.rs macro ( you can use macro get like HashMap<String,&Table> or HashMap<String,Table> )
use rbatis::rbdc::DateTime;
use rbatis::{table, table_field_btree, table_field_map, table_field_vec};

#[derive(serde::Serialize, serde::Deserialize,Default,Debug,Clone)]
pub struct Activity {
    pub id: Option<i64>,
    pub name: Option<String>,
    pub pc_link: Option<String>,
    pub h5_link: Option<String>,
    pub pc_banner_img: Option<String>,
    pub h5_banner_img: Option<String>,
    pub sort: Option<String>,
    pub status: Option<i32>,
    pub remark: Option<String>,
    pub create_time: Option<DateTime>,
    pub version: Option<i64>,
    pub delete_flag: Option<i32>,
}

fn main() {
    let tables: Vec<Activity> = vec![
        table!(Activity {
            id: Some(3),
            name: Some("3".to_string()),
        }),
        table!(Activity {
            id: Some(2),
            name: Some("2".to_string()),
        }),
        table!(Activity {
            id: Some(1),
            name: Some("1".to_string()),
        })];
    //map ref
    let hash = table_field_map!(&tables,id);
    println!("---hash={}", rbs::to_value!(hash));
    //map owned
    let hash_owned = table_field_map!(tables.clone(),id);
    println!("---hash={}", rbs::to_value!(hash_owned));
    //btree ref
    let btree = table_field_btree!(&tables,id);
    println!("---btree={}", rbs::to_value!(btree));
    //btree owned
    let btree_owned = table_field_btree!(tables.clone(),id);
    println!("---btree_owned={}", rbs::to_value!(btree_owned));
    //vec<ref>
    let ids= table_field_vec!(&tables,id);
    println!("---ids={}", rbs::to_value!(ids));
    //vec<owned>
    let ids= table_field_vec!(tables,id);
    println!("---ids owned={:?}", ids);
}
rbatis - v4.5.22

Published by zhuxiujia 6 months ago

what changes?

  • break change Intercept set return type -> Result<bool, Error> to -> Result<Option<bool>, Error>
    /// if return None will be return result
    /// if return Some(true) will be run next intercept
    /// if return Some(false) will be break
rbatis - v4.5.21

Published by zhuxiujia 7 months ago

what changes?

  • html_sql,py_sql support break node
  • support update_by_column_skip, update_by_column_batch_skip for #501
  • html_sql,py_sql the bind node will set value to arg.
  • rbs ValueMap use index_map crate
rbatis - v4.5.20

Published by zhuxiujia 7 months ago

what changes?

  • fix #498
  • RBatisConnExecutor rb_task_id use new_snowflake_id()
rbatis - v4.5.19

Published by zhuxiujia 7 months ago

what Changes?

  • (new features) open debug_mode , will be show decoding invalid type Which field did the parsing fail. you can see error("invalid type: integer `1`, expected a string, key=`status`")
    for example:
#toml
rbatis = { version = "4.5", features = ["debug_mode"]}
/// table
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Activity {
    pub status: Option<String>,
}
//log
[INFO] [rbatis] [608325834525440517] query <= len=1,rows=[{"status":1}]

called `Result::unwrap()` on an `Err` value: E("invalid type: integer `1`, expected a string, key = `status`")
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\panicking.rs:645
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src\panicking.rs:72


rbatis - v4.5.18

Published by zhuxiujia 8 months ago

what change?

  • (bug) fix tx.done when commit() rollback() not set tx.done = true
  • (bug) fix table_sync column type override bug.
  • (clean) crud macro remove Clone、Debug trait request
  • (new features) sqlite driver support return JSON Object/JSON Array. (before version JSON objects and arrays is JSON string)
rbatis - v4.5.17

Published by zhuxiujia 8 months ago

what changes?

  • crud macro remove Clone、Debug trait request
  • fix table_sync column type override bug.
  • sqlite driver support return JSON Object/JSON Array. (before version JSON objects and arrays is JSON string)
rbatis - v4.5.16

Published by zhuxiujia 8 months ago

what changes?

  • fix table_sync column type override bug.

now you can use

#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Account {
    pub id: Option<u64>,
    pub name: Option<String>,
}

#[derive(Clone, serde::Serialize, serde::Deserialize)]
pub struct User {
    pub id: Option<u64>,
    //json support json object/array/null
    pub account1: Account,
    //json support json object/array/null
    pub account2: Vec<Account>,
}
async fn create_table(rb: &RBatis) {
    fast_log::LOGGER.set_level(LevelFilter::Off);
    defer!(||{
         fast_log::LOGGER.set_level(LevelFilter::Info);
    });
    // let table = User {
    //     id: Some(1),
    //     account1: Account {
    //         id: Some(1),
    //         name: Some("".to_string()),
    //     },
    //     account2: vec![Account {
    //         id: Some(1),
    //         name: Some("".to_string()),
    //     }],
    // };
    let table = to_value!{
        "id":"INTEGER PRIMARY KEY AUTOINCREMENT",
        "account1":"JSON",
        "account2":"JSON",
    };
    let conn = rb.acquire().await.unwrap();
    _ = table_sync::sync(&conn, &SqliteTableMapper {}, to_value!(&table), "user").await.unwrap();
}
rbatis - v4.5.15

Published by zhuxiujia 8 months ago

what changes?

  • fix impl_select_page macro issue of failed compilation of ownership parameters
rbatis - v4.5.14

Published by zhuxiujia 8 months ago

what changes?

  • support of #490
  • crud macro Generate the 'snake-case' table name on compile-time
rbatis - v4.5.13

Published by zhuxiujia 9 months ago

what changes?

  • rbdc Connection trait add some translation methods
  • rbdc-mssql rewrite Connection trait translation methods
  • rbatis remove tx plugin
rbatis - v4.5.12

Published by zhuxiujia 9 months ago

v4.5.12

  • fix tx use intercept
  • add TxIntercept
rbatis - v4.5.11

Published by zhuxiujia 9 months ago

what changes?

  • LogInterceptor remove replace_holder
rbatis - v4.5.10

Published by zhuxiujia 10 months ago

what changes?

  • deprecated sql mod
  • page,tx move to plugin
  • Require rust compiler 1.75,maybe you need run rustup update
rbatis - v4.5.7

Published by zhuxiujia 10 months ago

v4.5.7

what changes?

  • add new crates fast_pool
  • add new crates rbdc-pool-fast based on fast_pool
  • Pool Performance improvement
  • Require rust compiler 1.75,maybe you need run rustup update
// bench method pool.get().await.unwrap()
//windows:
//---- bench_pool stdout ----
//use Time: 4.0313ms ,each:40 ns/op
//use QPS: 24749412 QPS/s
//macos:
//---- bench_pool stdout ----
// use Time: 6.373708ms ,each:63 ns/op
// use QPS: 15683710 QPS/s
rbatis - v4.5.6

Published by zhuxiujia 11 months ago

v4.5.6

  • move IntoSql trait to rbatis-codegen
  • rbatis-codegen fix many bug
  • rbatis-codegen add impl_numeric_bitand! { op_bit_and_u64[u8 u16 u32 u64] -> u64 op_bit_and_i64[i8 i16 i32 i64 isize] -> i64 } and impl_numeric_bitor! { op_bit_or_u64[u8 u16 u32 u64] -> u64 op_bit_or_i64[i8 i16 i32 i64 isize] -> i64 }
  • add many test for html-sql
    just like
<select id="test_binary">
 `${id + 1},${id - 1},${id * 1},${id / 1},${id % 1},${id & 1},${id | 1},${id == 1},${id < 1},${id <= 1},${id != 1},${id >= 1},${id > 1},${id ^ 1},${b && true},${b || true}`
</select>
rbatis - v4.5.5

Published by zhuxiujia 11 months ago

v4.5.5

  • add DefaultPool
    pub use rbdc_pool_mobc::MobcPool as DefaultPool;