Skip to content

Commit cfbbda7

Browse files
committed
fix(examples): compilation errors, warnings in preferred-crates
1 parent 0694fd4 commit cfbbda7

File tree

2 files changed

+7
-3
lines changed
  • examples/postgres/preferred-crates

2 files changed

+7
-3
lines changed

examples/postgres/preferred-crates/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async fn main() -> anyhow::Result<()> {
3434
uses_rust_decimal::create_table(&mut conn).await?;
3535
uses_time::create_table(&mut conn).await?;
3636

37-
let user_id = sqlx::query!(
37+
let user_id = sqlx::query_scalar!(
3838
"insert into users(username, password_hash) values($1, $2) returning id",
3939
"user_foo",
4040
"<pretend this is a password hash>",
@@ -46,6 +46,8 @@ async fn main() -> anyhow::Result<()> {
4646
.fetch_one(&mut conn)
4747
.await?;
4848

49+
println!("Created user: {user:?}");
50+
4951
let session =
5052
uses_time::create_session(&mut conn, SessionData { user_id }, SESSION_DURATION).await?;
5153

@@ -62,5 +64,7 @@ async fn main() -> anyhow::Result<()> {
6264
.await?
6365
.expect("expected purchase");
6466

67+
println!("Created purchase: {purchase:?}");
68+
6569
Ok(())
6670
}

examples/postgres/preferred-crates/uses-rust-decimal/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use chrono::{DateTime, Utc};
22
use sqlx::PgExecutor;
33

4-
#[derive(sqlx::FromRow)]
5-
struct Purchase {
4+
#[derive(sqlx::FromRow, Debug)]
5+
pub struct Purchase {
66
pub id: Uuid,
77
pub user_id: Uuid,
88
pub amount: Decimal,

0 commit comments

Comments
 (0)