Skip to content

Commit 424130d

Browse files
committed
Updated to new rorm-db syntax
1 parent b42253a commit 424130d

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ name = "rorm"
2424
crate-type = ["staticlib", "cdylib"]
2525

2626
[dependencies]
27-
rorm-db = { version = "~0.3", path = "rorm-db" }
27+
rorm-db = { version = "~0.4", path = "rorm-db" }
2828

2929
# Runtime to execute the async context in
30-
tokio = { version = "~1.22" }
30+
tokio = { version = "~1.23" }
3131

3232
# Async wrapper
3333
futures = { version = "~0.3" }
@@ -39,7 +39,7 @@ sqlx = { version = "~0.6" }
3939
chrono = { version = "~0.4" }
4040

4141
# Optional logging framework
42-
env_logger = { version = "~0.9", optional = true }
42+
env_logger = { version = "~0.10", optional = true }
4343

4444
[features]
4545
default = [

src/lib.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use std::time::Duration;
1414
use futures::StreamExt;
1515
use rorm_db::aggregation::SelectAggregator;
1616
use rorm_db::database::{ColumnSelector, JoinTable};
17+
use rorm_db::executor;
1718
use rorm_db::join_table::JoinType;
1819
use rorm_db::ordering::OrderByEntry;
1920
use rorm_db::row::Row;
@@ -622,7 +623,7 @@ pub extern "C" fn rorm_db_query_one(
622623
match cond {
623624
None => {
624625
match db
625-
.query_one(
626+
.query::<executor::One>(
626627
model_conv.unwrap(),
627628
column_vec.as_slice(),
628629
join_vec.as_slice(),
@@ -641,7 +642,7 @@ pub extern "C" fn rorm_db_query_one(
641642
};
642643
}
643644
Some(c) => match db
644-
.query_one(
645+
.query::<executor::One>(
645646
model_conv.unwrap(),
646647
column_vec.as_slice(),
647648
join_vec.as_slice(),
@@ -859,7 +860,7 @@ pub extern "C" fn rorm_db_query_optional(
859860
match cond {
860861
None => {
861862
match db
862-
.query_optional(
863+
.query::<executor::Optional>(
863864
model_conv.unwrap(),
864865
column_vec.as_slice(),
865866
join_vec.as_slice(),
@@ -885,7 +886,7 @@ pub extern "C" fn rorm_db_query_optional(
885886
};
886887
}
887888
Some(c) => match db
888-
.query_optional(
889+
.query::<executor::Optional>(
889890
model_conv.unwrap(),
890891
column_vec.as_slice(),
891892
join_vec.as_slice(),
@@ -1109,7 +1110,7 @@ pub extern "C" fn rorm_db_query_all(
11091110
.collect();
11101111
let query_res = match cond {
11111112
None => {
1112-
db.query_all(
1113+
db.query::<executor::All>(
11131114
model_conv.unwrap(),
11141115
column_vec.as_slice(),
11151116
join_vec.as_slice(),
@@ -1121,7 +1122,7 @@ pub extern "C" fn rorm_db_query_all(
11211122
.await
11221123
}
11231124
Some(cond) => {
1124-
db.query_all(
1125+
db.query::<executor::All>(
11251126
model_conv.unwrap(),
11261127
column_vec.as_slice(),
11271128
join_vec.as_slice(),
@@ -1329,7 +1330,7 @@ pub extern "C" fn rorm_db_query_stream(
13291330
}
13301331

13311332
let query_stream = match condition {
1332-
None => db.query_stream(
1333+
None => db.query::<executor::Stream>(
13331334
model_conv.unwrap(),
13341335
column_vec.as_slice(),
13351336
join_vec.as_slice(),
@@ -1352,7 +1353,7 @@ pub extern "C" fn rorm_db_query_stream(
13521353
}
13531354
return;
13541355
}
1355-
db.query_stream(
1356+
db.query::<executor::Stream>(
13561357
model_conv.unwrap(),
13571358
column_vec.as_slice(),
13581359
join_vec.as_slice(),
@@ -1363,7 +1364,13 @@ pub extern "C" fn rorm_db_query_stream(
13631364
)
13641365
}
13651366
};
1366-
unsafe { cb(context, Some(Box::new(query_stream)), Error::NoError) }
1367+
unsafe {
1368+
cb(
1369+
context,
1370+
Some(Box::new(query_stream.boxed())),
1371+
Error::NoError,
1372+
)
1373+
}
13671374
}
13681375

13691376
/**

0 commit comments

Comments
 (0)