Releases: rbatis/rbatis
Releases · rbatis/rbatis
v4.5.22
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
- add control intercept example see plugin_intercept_log_next
and
plugin_intercept_log_scope
v4.5.21
v4.5.20
v4.5.19
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
v4.5.18
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)
v4.5.17
v4.5.16
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();
}