Skip to content

Commit be12f08

Browse files
committed
example
1 parent d379c80 commit be12f08

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

examples/sqlx_postgres/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ publish = false
1111
[dependencies]
1212
chrono = { version = "0.4", default-features = false, features = ["clock"] }
1313
time = { version = "0.3.36", features = ["macros"] }
14+
jiff = { version = "0.2.15", features = ["std"] }
1415
uuid = { version = "1", features = ["serde", "v4"] }
1516
serde_json = "1"
1617
rust_decimal = { version = "1" }
@@ -28,6 +29,7 @@ sea-query-binder = { path = "../../sea-query-binder", features = [
2829
"with-bigdecimal",
2930
"with-uuid",
3031
"with-time",
32+
"with-jiff",
3133
"with-ipnetwork",
3234
"with-mac_address",
3335
"runtime-async-std-native-tls",

examples/sqlx_postgres/src/main.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@ async fn main() {
2626

2727
// Schema
2828

29+
let sql = Table::drop()
30+
.table(Character::Table)
31+
.if_exists()
32+
.build(PostgresQueryBuilder);
33+
34+
let result = sqlx::query(&sql).execute(&mut *pool).await;
35+
println!("Drop table character: {result:?}\n");
36+
2937
let sql = Table::create()
3038
.table(Character::Table)
31-
.if_not_exists()
3239
.col(
3340
ColumnDef::new(Character::Id)
3441
.integer()
@@ -78,11 +85,12 @@ async fn main() {
7885
.unwrap()
7986
.with_scale(3)
8087
.into(),
81-
NaiveDate::from_ymd_opt(2020, 8, 20)
82-
.unwrap()
83-
.and_hms_opt(0, 0, 0)
84-
.unwrap()
85-
.into(),
88+
// NaiveDate::from_ymd_opt(2020, 8, 20)
89+
// .unwrap()
90+
// .and_hms_opt(0, 0, 0)
91+
// .unwrap()
92+
// .into(),
93+
jiff::civil::date(2020, 8, 20).at(0, 0, 0, 0).into(),
8694
IpNetwork::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8)
8795
.unwrap()
8896
.into(),

0 commit comments

Comments
 (0)