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 - v1.8.20

Published by zhuxiujia almost 4 years ago

v1.8.20

  • py-sql support same line Continuous writing, use ': ' split(Note the middle part: add space).

for example(this example will be 'for' first ,then to do 'trim'):

    #[py_sql(RB, "insert into biz_activity
                  (
                  trim ',': for key,item in arg:
                     ${key},
                  ) VALUES (
                  trim ',': for v in arg:
                      #{v},
                  )   ")]
    pub async fn py_insert(arg: &BizActivity) -> DBExecResult {}
2020-11-15 22:18:07.008296500 +08:00 INFO rbatis::plugin::log - [rbatis] [] Exec ==> insert into biz_activity (  create_time, delete_flag, h5_banner_img, h5_link, id, name, pc_banner_img, pc_link, remark, sort, status, version  ) VALUES (  ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?  )
                                                                [rbatis] [] Args ==> ["2020-11-15T22:18:07.007182300",1,null,null,"12312","123",null,null,null,"1",1,"1"]
rbatis - v1.8.19

Published by zhuxiujia almost 4 years ago

v1.8.19

  • remove xml module,No longer supported xml. Because PY-SQL is more flexible, readable, and simple than XML
  • Remove unnecessary global variables,move Py Cache、Struct into Rbatis instance
rbatis - v1.8.18

Published by zhuxiujia almost 4 years ago

v1.8.18

  • up sqlx version to 0.4.0
  • use 'pub use rbatis_core as core' so you can just use 2 of dep rbatis(), for example:

Please replace rbatis_core replace in your project with rbatis::core

# rbatis, must maintain the same versions (required)
rbatis =  { version = "1.8.18" } 
rbatis-macro-driver = { version = "1.8.18" }
rbatis - v1.8.16

Published by zhuxiujia almost 4 years ago

v1.8.16

  • express support access array
    for example:
    #[py_sql(RB, "select * from biz_activity
                  if arr[0]!=null:
                    where id in #{ arr[0] }")]
    fn py_select1(arr: &Vec<i32>) -> DBExecResult {}
2020-11-13 14:17:15.633393 +08:00 INFO rbatis::plugin::log - [rbatis] [] Query ==> select * from biz_activity where id in ?
2020-11-13 14:17:15.634024 +08:00 INFO rbatis::plugin::log - [rbatis] [] Args  ==> [1]

other example

  #[test]
    fn test_node_run() {
        let arg = json!({
	"e": [1],
	"f": [{
		"field": 1
	}]
});
        let exec_expr = |arg: &serde_json::Value, expr: &str| -> serde_json::Value{
            println!("{}", expr.clone());
            let box_node = parser::parse(expr, &OptMap::new()).unwrap();
            let v = box_node.eval(arg).unwrap();
            println!("'{}' -> {}", expr.clone(), &v);
            v
        };
        assert_eq!(exec_expr(&arg, "e[0]"), json!(1));
        assert_eq!(exec_expr(&arg, "f[0].field"), json!(1));
        assert_eq!(exec_expr(&arg, "f.0.field"), json!(1));
    }
rbatis - v1.8.15

Published by zhuxiujia almost 4 years ago

v1.8.15

  • support attr macro for CRUDEnable ,so you can custom table_name ,column ,id_name ,id type
    for example-1(All automatic generation):
    #[crud_enable]
    #[derive(Serialize, Deserialize, Clone, Debug)]
    pub struct BizActivity {
        pub id: Option<String>,
        pub name: Option<String>,
        pub delete_flag: Option<i32>,
    }

for example-2(Only the table name is changed, the rest is generated automatically):

    #[crud_enable(table_name:biz_activity)]
    #[derive(Serialize, Deserialize, Clone, Debug)]
    pub struct BizActivity {
        pub id: Option<String>,
        pub name: Option<String>,
        pub delete_flag: Option<i32>,
    }

for example-3(Full customization):

    #[crud_enable( id_name:id|  id_type:String|  table_name:biz_activity|  table_columns:id,name,delete_flag )]
    #[derive(Serialize, Deserialize, Clone, Debug)]
    pub struct BizActivity {
        pub id: Option<String>,
        pub name: Option<String>,
        pub delete_flag: Option<i32>,
    }
rbatis - v1.8.14

Published by zhuxiujia almost 4 years ago

v1.8.14

  • fix wrapper.push() method index error (Pg database)
  • CRUDEnable add fn id_column_name() ,so you can rewrite this name
rbatis - v1.8.13

Published by zhuxiujia almost 4 years ago

v1.8.13

  • recode py lang parser
  • fix ${} json value format
rbatis - v1.8.12

Published by zhuxiujia almost 4 years ago

v1.8.12

  • fix for each bug
rbatis - v1.8.11

Published by zhuxiujia almost 4 years ago

v1.8.11

  • fix Wrapper order_by trim bug
  • fix #51
  • py_lang,xml_lang for_each node add support map collection
rbatis - v1.8.10

Published by zhuxiujia almost 4 years ago

v1.8.10

  • fix express: 'null+1' or 'null-1' Calculation error bug
rbatis - v1.8.9

Published by zhuxiujia almost 4 years ago

v1.8.9

  • py lang support comments
  • express eval method support equal object, array
  • express engine support new opt for '%' ,'^'
  • express parse test will be exec befor,in scan init method
rbatis - v1.8.8

Published by zhuxiujia almost 4 years ago

v1.8.8

  • up async_std version to 1.7, also support tokio03
rbatis - v1.8.7

Published by zhuxiujia almost 4 years ago

v1.8.7

  • fix #48 , add mysql,pg byte vec decode support . fix some type decode
  • add fetch_prepare_wrapper,exec_prepare_wrapper method for #47
rbatis - v1.8.6

Published by zhuxiujia almost 4 years ago

v1.8.6

  • snowflake id support

how to use?

toml add this

rbatis-core = { version = "1.8.6" }
rbatis = { version = "1.8.6", features = ["snowflake"] }
rbatis-macro-driver = { version = "1.8.6", features = ["no_print"] }

code

  async_std::task::block_on(async{
      let id: i64 = rbatis::plugin::snowflake::async_snowflake_id().await;
      println!("{}",id);
});
rbatis - v1.8.5

Published by zhuxiujia almost 4 years ago

v1.8.5

  • fix Rbatis 1.8 version decimal decode bug
rbatis - v1.8.4

Published by zhuxiujia almost 4 years ago

v1.8.4

  • fix some bugs
  • clear some code
rbatis - v1.8.3

Published by zhuxiujia almost 4 years ago

v1.8.3

  • fix decode bug
  • add mssql/SqlServer database driver support
rbatis - v1.8.1

Published by zhuxiujia almost 4 years ago

En:

  • rbatis-core based on SQLX
  • rbatis-core recode support last_insert_id and rows_affected

中文:

  • rbatis-core 底层驱动更换为sqlx
  • rbatis-core 重构后,支持 last_insert_id 和 rows_affected。支持Save操作后获得某些数据库(Mysql、Sqlite)的插入Id(注意高并发情况下避免使用。用uuid替代)
rbatis - v1.7.26

Published by zhuxiujia almost 4 years ago

v1.7.26

  • rbatis-macro-driver add Conditional compilation, only need one features = ["no_print"] disable print code
  • rbatis-core add try_acquire method
rbatis - v1.7.25

Published by zhuxiujia almost 4 years ago

v1.7.25

  • fix #44, update rbatis-core to version "0.3.7"