Skip to content

Commit

Permalink
Merge pull request #12 from makorne/patch-1
Browse files Browse the repository at this point in the history
Added updated_at Datetime that causes decode error
  • Loading branch information
MikhailNazarov authored Nov 11, 2024
2 parents 5da33f0 + 72a8e5a commit 93ef5f7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions example/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::time::SystemTime;
use tracing::info;
use tracing_log::log::LevelFilter;
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
Expand All @@ -18,15 +19,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
assert_eq!(row.0, 2);

let conn = pool.acquire().await?;
sqlx::query("CREATE TABLE test4 (id Uint64 NOT NULL, name Utf8, age UInt8 NOT NULL, description Utf8, PRIMARY KEY (id))")
sqlx::query("CREATE TABLE test4 (id Uint64 NOT NULL, name Utf8, age UInt8 NOT NULL, description Utf8, updated_at DateTime, PRIMARY KEY (id))")
.execute(conn.schema())
.await?;

let test_user_info = UserInfo {
id: 13u64,
name: "test".to_string(),
age: 32u8,
description: None
description: None,
updated_at: None
};

let res = sqlx::query("DELETE FROM test4 where id = $id")
Expand All @@ -36,7 +38,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
info!("rows affected: {}", res.rows_affected());


sqlx::query("INSERT INTO test4 (id, name, age, description) VALUES ( $arg_1, $arg_2, $age, $arg_3)")
sqlx::query("INSERT INTO test4 (id, name, age, description, updated_at) VALUES ( $arg_1, $arg_2, $age, $arg_3, CurrentUtcDate())")
.bind(test_user_info.id)
.bind(test_user_info.name)
.bind(("age", test_user_info.age))
Expand Down Expand Up @@ -64,6 +66,7 @@ struct UserInfo {
name: String,
age: u8,
description: Option<String>,
updated_at: Option<SystemTime>
}

fn init_logs() {
Expand Down

0 comments on commit 93ef5f7

Please sign in to comment.