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 visible (Hide)

rbatis - v3.0.13

Published by zhuxiujia almost 3 years ago

v3.0.13

fix rbatis::Bytes decode(sqlite)

rbatis - v3.0.11

Published by zhuxiujia almost 3 years ago

v3.0.11

  • Date type serialization format changed
  • rbatis_sql support string cmp , add bracket() method
rbatis - v3.0.9

Published by zhuxiujia almost 3 years ago

v3.0.9

  • fix rbatis::Bytes Serialize
rbatis - v3.0.8

Published by zhuxiujia almost 3 years ago

v3.0.8

  • add feature format_bson to show some bson binary data
rbatis - v3.0.7

Published by zhuxiujia almost 3 years ago

v3.0.7

  • up sqlx-core version
  • fix decode error
rbatis - v3.0.5

Published by zhuxiujia almost 3 years ago

v3.0.5

  • impl from trait for rbatis::* types
rbatis - v3.0.4

Published by zhuxiujia almost 3 years ago

v3.0.4

  • fix null value bind
rbatis - v3.0.2

Published by zhuxiujia almost 3 years ago

v3.0.2

  • rbatis_sql add method for bson value.cast_string() , value.cast_i64() value.cast_f64()
  • add macro impl_field_name_method and field_name
///We can use rbatis built-in macros to improve maintainability
#[cfg(test)]
mod test {
    use rbatis::DriverType;
    use rbatis::wrapper::Wrapper;

    #[crud_table]
    #[derive(Clone, Debug)]
    pub struct BizActivity {
        pub id: Option<String>,
        pub name: Option<String>,
        pub delete_flag: Option<i32>,
    }
    // this macro will create impl BizActivity{ pub fn id()->&str ..... }
    impl_field_name_method!(BizActivity{id,name,delete_flag});
    #[test]
    fn test_improve_maintainability() {
        // When name is changed to user_name, the code becomes unmaintainable,
        // compiling well but with logic errors
        let w = Wrapper::new(&DriverType::Mysql)
            .eq("id","1")
            .eq("name", "xiao ming")
            .eq("delete_flag",1);

        assert_eq!(w.sql,"id = ? and name = ? and delete_flag = ?");

        // so we change "name" to column_name!(BizActivity::name),
        // when field name change to user_name ,it will be Compilation fails
        let w = Wrapper::new(&DriverType::Mysql)
            .eq(field_name!(BizActivity.id),"1")
            .eq(field_name!(BizActivity.name), "xiao ming")
            .eq(field_name!(BizActivity.delete_flag),1);

        assert_eq!(w.sql,"id = ? and name = ? and delete_flag = ?");

        let w = Wrapper::new(&DriverType::Mysql)
            .eq(BizActivity::id(),"1")
            .eq(BizActivity::name(), "xiao ming")
            .eq(BizActivity::delete_flag(),1);

        assert_eq!(w.sql,"id = ? and name = ? and delete_flag = ?");
    }
}
rbatis - v3.0.1

Published by zhuxiujia almost 3 years ago

v3.0.1

  • fix Wrapper order_by and group_by Loss of space
rbatis - v3.0.0

Published by zhuxiujia almost 3 years ago

v3.0.0

  • The underlying rewrite uses Bson serialization and deserialization
  • Added runtime conditional compilation selection
#choose rbatis runtime(default is ["all-database","runtime-async-std-rustls"])
runtime-tokio-rustls = ["rbatis-core/runtime-tokio-rustls"]
runtime-actix-rustls = ["rbatis-core/runtime-actix-rustls"]
runtime-async-std-rustls = ["rbatis-core/runtime-async-std-rustls"]
runtime-tokio-native-tls = ["rbatis-core/runtime-tokio-native-tls"]
runtime-actix-native-tls = ["rbatis-core/runtime-actix-native-tls"]
runtime-async-std-native-tls = ["rbatis-core/runtime-async-std-native-tls"]
  • Supported data structures(Don't need to format)

Some types support deserialization of multiple types (for example, rbatis::DateNative can be deserialized by bson String or Bson Bytes)

data structure is supported
Option
Vec
HashMap
i32,i64,f32,f64,bool,String...more rust type
rbatis::Bytes
rbatis::DateNative
rbatis::DateUtc
rbatis::DateTimeNative
rbatis::DateTimeUtc
rbatis::Decimal
rbatis::Json
rbatis::TimeNative
rbatis::TimeUtc
rbatis::Timestamp
rbatis::TimestampZ
rbatis::Uuid
rbatis::plugin::page::{Page, PageRequest}
bson::*
serde_json::*
any serde type
rbatis - v2.1.9

Published by zhuxiujia almost 3 years ago

v2.1.9

  • fix wrapper between sql
rbatis - v2.1.8

Published by zhuxiujia almost 3 years ago

v2.1.8

  • fix mssql Wrapper.push_wrapper() bug
rbatis - v2.1.7

Published by zhuxiujia almost 3 years ago

v2.1.7

  • RbJson/RbBytes Allows deserialization of internal data or compatible data
    for example:
let v: RbJson = serde_json::from_str("{\"rb_json\":1}").unwrap();
        println!("{:?}", v);
        let v: RbJson = serde_json::from_str("{\"ds\":1}").unwrap();
        println!("{:?}", v);
        let v: RbJson = serde_json::from_str("1").unwrap();
        println!("{:?}", v);
        let v: RbJson = serde_json::from_str("\"string\"").unwrap();
        println!("{:?}", v);
        let v: RbJson = serde_json::from_str("true").unwrap();
        println!("{:?}", v);
rbatis - v2.1.5

Published by zhuxiujia almost 3 years ago

v2.1.5

  • change RbatisExecutor<'_> lifetime to RbatisExecutor<'_,'_>
rbatis - v2.1.4

Published by zhuxiujia about 3 years ago

v2.1.4

  • fix BigDecimal type decode
rbatis - v2.1.3

Published by zhuxiujia about 3 years ago

v2.1.3

  • fix #146
rbatis - v2.1.2

Published by zhuxiujia about 3 years ago

v2.1.2

  • support Bytes and Json type.
    use rbatis::core::types::byte::RbBytes;
    use rbatis::core::types::json::RbJson;

    #[crud_table]
    #[derive(Clone, Debug)]
    pub struct Table {
       pub bytes: Option<RbBytes>,
       pub json: Option<RbJson>,
    }
  • crud.rs remove wrapper reference。 so you should change code &rb.new_wrapper() to rb.new_wrapper()
rbatis - v2.0.30

Published by zhuxiujia about 3 years ago

v2.0.30

  • fix py_sql/html_sql where node
rbatis - v2.0.29

Published by zhuxiujia about 3 years ago

v2.0.29

  • Py_sql/html_SQL is implemented using the new bind method to remove MUT variables and prevent problems caused by duplicate variables
rbatis - v2.0.28

Published by zhuxiujia about 3 years ago

v2.0.28

  • fix Exploit bugs caused by duplicate variables
  • fix where set element,Use the trim space followed by the trim and or keyword