Rust Compile Time ORM robustness,async, pure Rust Dynamic SQL
APACHE-2.0 License
Published by zhuxiujia about 4 years ago
v1.5.5
Published by zhuxiujia about 4 years ago
v1.5.3
fix #15
Published by zhuxiujia about 4 years ago
v1.5.2
Published by zhuxiujia about 4 years ago
fix [#12]
Published by zhuxiujia about 4 years ago
v1.5.0
//toml
rbatis-macro-driver = { version = "1.5.0" }
// code
#[macro_use]
extern crate rbatis_macro_driver;
#[derive(CRUDEnable,Serialize, Deserialize, Clone, Debug)]
pub struct BizActivity {
pub id: Option<String>,
pub name: Option<String>,
pub delete_flag: Option<i32>
//...
}
pub fn test_fetch_by_id() {
async_std::task::block_on(async {
let rb = Rbatis::new();
rb.link("mysql://root:123456@localhost:3306/test").await.unwrap();
let r = rb.fetch_by_id::<Option<BizActivity>>("", &"1".to_string()).await.unwrap();
println!("{}",serde_json::to_string(&r).unwrap());
});
}
Published by zhuxiujia about 4 years ago
v1.4.8
let p = Option::<i32>::Some(1);
let w = Wrapper::new(&DriverType::Postgres)
.do_if(p.is_some(), |w| w.eq("a", p))
.check().unwrap();
println!("arg:{:?}", w.args.clone());
//结果:
//sql:"a = $1 "
//arg:[Number(1)]
let p = 1;
let w = Wrapper::new(&DriverType::Postgres)
.do_match(&[
Case::new(p==0, |w| w.eq("a","some")),
Case::new(p==2, |w| w.eq("a","none")),
], |w| w.eq("a","default"))
.check().unwrap();
println!("arg:{:?}", w.args.clone());
//结果:
//sql:"a = $1 "
//arg:[String("default")]
Published by zhuxiujia about 4 years ago
v1.4.4 LogicPlugin add custom value enable
Published by zhuxiujia about 4 years ago
v1.4.3 免去了写 Rbatis<'static> 生命周期常量,增加NativeDateTime::now()方法
Published by zhuxiujia about 4 years ago
v1.4.2 support NativeDateTime
Published by zhuxiujia about 4 years ago
v1.4.1
custom connection pool
可以自定义连接池参数
Published by zhuxiujia about 4 years ago
v1.4.0
use new version for fast_log,Double performance
use DashMap replace to SyncMap
新版使用了fast_log 1.2.3,使用了无锁队列相比老版本提高近一倍性能
使用DashMap替换了原来的SyncMap,内部使用读写锁,相对提高了性能
Published by zhuxiujia about 4 years ago
v1.3.7 wrapper not necessary append .and()
for example:
let mut m = Map::new();
m.insert("a".to_string(), json!("1"));
let w = Wrapper::new(&DriverType::Mysql).eq("id", 1)
.ne("id", 1)
.in_array("id", &[1, 2, 3])
.not_in("id", &[1, 2, 3])
.all_eq(&m)
.like("name", 1)
.or()
.not_like("name", "asdf")
.between("create_time", "2020-01-01 00:00:00", "2020-12-12 00:00:00")
.group_by(&["id"])
.order_by(true, &["id", "name"])
.check().unwrap();
//sql => id = ? AND id <> ? AND id IN ( ? , ? , ? ) AND id NOT IN ( ? , ? , ? ) AND a = ? AND name LIKE '% ? %' OR OR name NOT LIKE '% ? %' AND create_time BETWEEN ? AND ? GROUP BY id ORDER BY id ASC , name ASC
Published by zhuxiujia about 4 years ago
v1.3.5 fix page plugin bug
Published by zhuxiujia about 4 years ago
v1.3.1 fix LogicDelete Plugin
修复逻辑删除插件
Published by zhuxiujia over 4 years ago
v1.2.8
修复save方法存储为null的bug
Published by zhuxiujia over 4 years ago
v1.2.7
now we support return Option for CRUDEnable trait
for example:
let r: Result<Option<BizActivity>, Error> = rb.fetch_by_wrapper("", &w).await;
我们现在支持 查询返回 Option 的结果类型,方便某些场景下, 查询某条记录查询不到的情况返回空值。
Published by zhuxiujia over 4 years ago
fix bugs
Published by zhuxiujia over 4 years ago
v1.2.5 fix some bugs
Published by zhuxiujia over 4 years ago
v1.2.1 add wrapper
Published by zhuxiujia over 4 years ago
v1.1.3 add convert