Reputation: 21
I'm trying to use the UUID data-type for the club_uid
field in my Announcement
struct. However, I'm receiving the following error message:
the trait bound `Uuid: sqlx::Decode<'_, _>` is not satisfied
the following other types implement trait `sqlx::Decode<'r, DB>`:
<bool as sqlx::Decode<'r, sqlx::Any>>
<bool as sqlx::Decode<'_, Postgres>>
<i8 as sqlx::Decode<'_, Postgres>>
<i16 as sqlx::Decode<'r, sqlx::Any>>
<i16 as sqlx::Decode<'_, Postgres>>
<i32 as sqlx::Decode<'r, sqlx::Any>>
<i32 as sqlx::Decode<'_, Postgres>>
<i64 as sqlx::Decode<'r, sqlx::Any>>
Here is the code I wrote:
use actix_web::{
get, post,
web::{Data, Json, Path},
Responder, HttpResponse
};
use serde::{Deserialize, Serialize} ;
use sqlx::{self, FromRow};
use uuid::{uuid, Uuid};
use crate::AppState;
#[derive(Serialize, FromRow)]
struct Announcement {
announcement_uid: String,
info: String,
date: String,
club_uid: Uuid
}
#[post("/announcement")]
pub async fn create_announcement(state: Data<AppState>, body: Json<CreateAnnouncement>) -> impl Responder {
match sqlx::query_as::<_, Announcement>(
"INSERT INTO announcement (announcement_uid, info, date, club_uid) VALUES (uuid_generate_v4(), $1, $2, $3) RETURNING announcement_uid, info, date"
)
.bind(body.info.to_string())
.bind(body.date.to_string())
.bind(Uuid::parse_str(body.club_uid.as_str()))
.fetch_one(&state.db)
.await
{
Ok(announcement) => HttpResponse::Ok().json(announcement),
Err(e) => {
println!("{}", e);
HttpResponse::InternalServerError().json("Failed to create club announcement")
}
}
}
I tried manually implementing the mentioned traits but I'm really new to Rust so I don't know how to get around this issue.
Here's my cargo.toml
for reference:
[package]
name = "announcement-api"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix = "0.13.3"
actix-web = "4.5.1"
chrono = "0.4.35"
dotenv = "0.15.0"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114"
sqlx = { version = "0.7.4", features = ["runtime-async-std-native-tls", "postgres"] }
uuid = { version = "1.7.0", features = ["v4", "serde"] }
Here's the result of cargo tree
as well:
├── actix v0.13.3
│ ├── actix-macros v0.2.4 (proc-macro)
│ │ ├── quote v1.0.35
│ │ │ └── proc-macro2 v1.0.79
│ │ │ └── unicode-ident v1.0.12
│ │ └── syn v2.0.53
│ │ ├── proc-macro2 v1.0.79 (*)
│ │ ├── quote v1.0.35 (*)
│ │ └── unicode-ident v1.0.12
│ ├── actix-rt v2.9.0
│ │ ├── futures-core v0.3.30
│ │ └── tokio v1.36.0
│ │ ├── bytes v1.5.0
│ │ ├── mio v0.8.11
│ │ │ ├── log v0.4.21
│ │ │ │ └── value-bag v1.8.0
│ │ │ └── windows-sys v0.48.0
│ │ │ └── windows-targets v0.48.5
│ │ │ └── windows_x86_64_msvc v0.48.5
│ │ ├── parking_lot v0.12.1
│ │ │ ├── lock_api v0.4.11
│ │ │ │ └── scopeguard v1.2.0
│ │ │ │ [build-dependencies]
│ │ │ │ └── autocfg v1.1.0
│ │ │ └── parking_lot_core v0.9.9
│ │ │ ├── cfg-if v1.0.0
│ │ │ ├── smallvec v1.13.1
│ │ │ └── windows-targets v0.48.5 (*)
│ │ ├── pin-project-lite v0.2.13
│ │ ├── socket2 v0.5.6
│ │ │ └── windows-sys v0.52.0
│ │ │ └── windows-targets v0.52.4
│ │ │ └── windows_x86_64_msvc v0.52.4
│ │ └── windows-sys v0.48.0 (*)
│ ├── actix_derive v0.6.1 (proc-macro)
│ │ ├── proc-macro2 v1.0.79 (*)
│ │ ├── quote v1.0.35 (*)
│ │ └── syn v2.0.53 (*)
│ ├── bitflags v2.4.2
│ ├── bytes v1.5.0
│ ├── crossbeam-channel v0.5.12
│ │ └── crossbeam-utils v0.8.19
│ ├── futures-core v0.3.30
│ ├── futures-sink v0.3.30
│ ├── futures-task v0.3.30
│ ├── futures-util v0.3.30
│ │ ├── futures-core v0.3.30
│ │ ├── futures-io v0.3.30
│ │ ├── futures-sink v0.3.30
│ │ ├── futures-task v0.3.30
│ │ ├── memchr v2.7.1
│ │ ├── pin-project-lite v0.2.13
│ │ ├── pin-utils v0.1.0
│ │ └── slab v0.4.9
│ │ [build-dependencies]
│ │ └── autocfg v1.1.0
│ ├── log v0.4.21 (*)
│ ├── once_cell v1.19.0
│ ├── parking_lot v0.12.1 (*)
│ ├── pin-project-lite v0.2.13
│ ├── smallvec v1.13.1
│ ├── tokio v1.36.0 (*)
│ └── tokio-util v0.7.10
│ ├── bytes v1.5.0
│ ├── futures-core v0.3.30
│ ├── futures-sink v0.3.30
│ ├── pin-project-lite v0.2.13
│ ├── tokio v1.36.0 (*)
│ └── tracing v0.1.40
│ ├── log v0.4.21 (*)
│ ├── pin-project-lite v0.2.13
│ ├── tracing-attributes v0.1.27 (proc-macro)
│ │ ├── proc-macro2 v1.0.79 (*)
│ │ ├── quote v1.0.35 (*)
│ │ └── syn v2.0.53 (*)
│ └── tracing-core v0.1.32
│ └── once_cell v1.19.0
├── actix-web v4.5.1
│ ├── actix-codec v0.5.2
│ │ ├── bitflags v2.4.2
│ │ ├── bytes v1.5.0
│ │ ├── futures-core v0.3.30
│ │ ├── futures-sink v0.3.30
│ │ ├── memchr v2.7.1
│ │ ├── pin-project-lite v0.2.13
│ │ ├── tokio v1.36.0 (*)
│ │ ├── tokio-util v0.7.10 (*)
│ │ └── tracing v0.1.40 (*)
│ ├── actix-http v3.6.0
│ │ ├── actix-codec v0.5.2 (*)
│ │ ├── actix-rt v2.9.0 (*)
│ │ ├── actix-service v2.0.2
│ │ │ ├── futures-core v0.3.30
│ │ │ ├── paste v1.0.14 (proc-macro)
│ │ │ └── pin-project-lite v0.2.13
│ │ ├── actix-utils v3.0.1
│ │ │ ├── local-waker v0.1.4
│ │ │ └── pin-project-lite v0.2.13
│ │ ├── ahash v0.8.11
│ │ │ ├── cfg-if v1.0.0
│ │ │ ├── getrandom v0.2.12
│ │ │ │ └── cfg-if v1.0.0
│ │ │ ├── once_cell v1.19.0
│ │ │ └── zerocopy v0.7.32
│ │ │ [build-dependencies]
│ │ │ └── version_check v0.9.4
│ │ ├── base64 v0.21.7
│ │ ├── bitflags v2.4.2
│ │ ├── brotli v3.5.0
│ │ │ ├── alloc-no-stdlib v2.0.4
│ │ │ ├── alloc-stdlib v0.2.2
│ │ │ │ └── alloc-no-stdlib v2.0.4
│ │ │ └── brotli-decompressor v2.5.1
│ │ │ ├── alloc-no-stdlib v2.0.4
│ │ │ └── alloc-stdlib v0.2.2 (*)
│ │ ├── bytes v1.5.0
│ │ ├── bytestring v1.3.1
│ │ │ └── bytes v1.5.0
│ │ ├── derive_more v0.99.17 (proc-macro)
│ │ │ ├── convert_case v0.4.0
│ │ │ ├── proc-macro2 v1.0.79 (*)
│ │ │ ├── quote v1.0.35 (*)
│ │ │ └── syn v1.0.109
│ │ │ ├── proc-macro2 v1.0.79 (*)
│ │ │ ├── quote v1.0.35 (*)
│ │ │ └── unicode-ident v1.0.12
│ │ │ [build-dependencies]
│ │ │ └── rustc_version v0.4.0
│ │ │ └── semver v1.0.22
│ │ ├── encoding_rs v0.8.33
│ │ │ └── cfg-if v1.0.0
│ │ ├── flate2 v1.0.28
│ │ │ ├── crc32fast v1.4.0
│ │ │ │ └── cfg-if v1.0.0
│ │ │ └── miniz_oxide v0.7.2
│ │ │ └── adler v1.0.2
│ │ ├── futures-core v0.3.30
│ │ ├── h2 v0.3.25
│ │ │ ├── bytes v1.5.0
│ │ │ ├── fnv v1.0.7
│ │ │ ├── futures-core v0.3.30
│ │ │ ├── futures-sink v0.3.30
│ │ │ ├── futures-util v0.3.30 (*)
│ │ │ ├── http v0.2.12
│ │ │ │ ├── bytes v1.5.0
│ │ │ │ ├── fnv v1.0.7
│ │ │ │ └── itoa v1.0.10
│ │ │ ├── indexmap v2.2.5
│ │ │ │ ├── equivalent v1.0.1
│ │ │ │ └── hashbrown v0.14.3
│ │ │ │ ├── ahash v0.8.11 (*)
│ │ │ │ └── allocator-api2 v0.2.16
│ │ │ ├── slab v0.4.9 (*)
│ │ │ ├── tokio v1.36.0 (*)
│ │ │ ├── tokio-util v0.7.10 (*)
│ │ │ └── tracing v0.1.40 (*)
│ │ ├── http v0.2.12 (*)
│ │ ├── httparse v1.8.0
│ │ ├── httpdate v1.0.3
│ │ ├── itoa v1.0.10
│ │ ├── language-tags v0.3.2
│ │ ├── local-channel v0.1.5
│ │ │ ├── futures-core v0.3.30
│ │ │ ├── futures-sink v0.3.30
│ │ │ └── local-waker v0.1.4
│ │ ├── mime v0.3.17
│ │ ├── percent-encoding v2.3.1
│ │ ├── pin-project-lite v0.2.13
│ │ ├── rand v0.8.5
│ │ │ ├── rand_chacha v0.3.1
│ │ │ │ ├── ppv-lite86 v0.2.17
│ │ │ │ └── rand_core v0.6.4
│ │ │ │ └── getrandom v0.2.12 (*)
│ │ │ └── rand_core v0.6.4 (*)
│ │ ├── sha1 v0.10.6
│ │ │ ├── cfg-if v1.0.0
│ │ │ ├── cpufeatures v0.2.12
│ │ │ └── digest v0.10.7
│ │ │ ├── block-buffer v0.10.4
│ │ │ │ └── generic-array v0.14.7
│ │ │ │ └── typenum v1.17.0
│ │ │ │ [build-dependencies]
│ │ │ │ └── version_check v0.9.4
│ │ │ ├── crypto-common v0.1.6
│ │ │ │ ├── generic-array v0.14.7 (*)
│ │ │ │ └── typenum v1.17.0
│ │ │ └── subtle v2.5.0
│ │ ├── smallvec v1.13.1
│ │ ├── tokio v1.36.0 (*)
│ │ ├── tokio-util v0.7.10 (*)
│ │ ├── tracing v0.1.40 (*)
│ │ └── zstd v0.13.0
│ │ └── zstd-safe v7.0.0
│ │ └── zstd-sys v2.0.9+zstd.1.5.5
│ │ [build-dependencies]
│ │ ├── cc v1.0.90
│ │ │ └── jobserver v0.1.28
│ │ └── pkg-config v0.3.30
│ ├── actix-macros v0.2.4 (proc-macro) (*)
│ ├── actix-router v0.5.2
│ │ ├── bytestring v1.3.1 (*)
│ │ ├── http v0.2.12 (*)
│ │ ├── regex v1.10.3
│ │ │ ├── aho-corasick v1.1.2
│ │ │ │ └── memchr v2.7.1
│ │ │ ├── memchr v2.7.1
│ │ │ ├── regex-automata v0.4.6
│ │ │ │ ├── aho-corasick v1.1.2 (*)
│ │ │ │ ├── memchr v2.7.1
│ │ │ │ └── regex-syntax v0.8.2
│ │ │ └── regex-syntax v0.8.2
│ │ ├── serde v1.0.197
│ │ │ └── serde_derive v1.0.197 (proc-macro)
│ │ │ ├── proc-macro2 v1.0.79 (*)
│ │ │ ├── quote v1.0.35 (*)
│ │ │ └── syn v2.0.53 (*)
│ │ └── tracing v0.1.40 (*)
│ ├── actix-rt v2.9.0 (*)
│ ├── actix-server v2.3.0
│ │ ├── actix-rt v2.9.0 (*)
│ │ ├── actix-service v2.0.2 (*)
│ │ ├── actix-utils v3.0.1 (*)
│ │ ├── futures-core v0.3.30
│ │ ├── futures-util v0.3.30 (*)
│ │ ├── mio v0.8.11 (*)
│ │ ├── socket2 v0.5.6 (*)
│ │ ├── tokio v1.36.0 (*)
│ │ └── tracing v0.1.40 (*)
│ ├── actix-service v2.0.2 (*)
│ ├── actix-utils v3.0.1 (*)
│ ├── actix-web-codegen v4.2.2 (proc-macro)
│ │ ├── actix-router v0.5.2 (*)
│ │ ├── proc-macro2 v1.0.79 (*)
│ │ ├── quote v1.0.35 (*)
│ │ └── syn v2.0.53 (*)
│ ├── ahash v0.8.11 (*)
│ ├── bytes v1.5.0
│ ├── bytestring v1.3.1 (*)
│ ├── cfg-if v1.0.0
│ ├── cookie v0.16.2
│ │ ├── percent-encoding v2.3.1
│ │ └── time v0.3.34
│ │ ├── deranged v0.3.11
│ │ │ └── powerfmt v0.2.0
│ │ ├── itoa v1.0.10
│ │ ├── num-conv v0.1.0
│ │ ├── powerfmt v0.2.0
│ │ ├── time-core v0.1.2
│ │ └── time-macros v0.2.17 (proc-macro)
│ │ ├── num-conv v0.1.0
│ │ └── time-core v0.1.2
│ │ [build-dependencies]
│ │ └── version_check v0.9.4
│ ├── derive_more v0.99.17 (proc-macro) (*)
│ ├── encoding_rs v0.8.33 (*)
│ ├── futures-core v0.3.30
│ ├── futures-util v0.3.30 (*)
│ ├── itoa v1.0.10
│ ├── language-tags v0.3.2
│ ├── log v0.4.21 (*)
│ ├── mime v0.3.17
│ ├── once_cell v1.19.0
│ ├── pin-project-lite v0.2.13
│ ├── regex v1.10.3 (*)
│ ├── serde v1.0.197 (*)
│ ├── serde_json v1.0.114
│ │ ├── itoa v1.0.10
│ │ ├── ryu v1.0.17
│ │ └── serde v1.0.197 (*)
│ ├── serde_urlencoded v0.7.1
│ │ ├── form_urlencoded v1.2.1
│ │ │ └── percent-encoding v2.3.1
│ │ ├── itoa v1.0.10
│ │ ├── ryu v1.0.17
│ │ └── serde v1.0.197 (*)
│ ├── smallvec v1.13.1
│ ├── socket2 v0.5.6 (*)
│ ├── time v0.3.34 (*)
│ └── url v2.5.0
│ ├── form_urlencoded v1.2.1 (*)
│ ├── idna v0.5.0
│ │ ├── unicode-bidi v0.3.15
│ │ └── unicode-normalization v0.1.23
│ │ └── tinyvec v1.6.0
│ │ └── tinyvec_macros v0.1.1
│ └── percent-encoding v2.3.1
├── chrono v0.4.35
│ ├── num-traits v0.2.18
│ │ [build-dependencies]
│ │ └── autocfg v1.1.0
│ └── windows-targets v0.52.4 (*)
├── dotenv v0.15.0
├── serde v1.0.197 (*)
├── serde_json v1.0.114 (*)
├── sqlx v0.7.4
│ ├── sqlx-core v0.7.4
│ │ ├── ahash v0.8.11 (*)
│ │ ├── async-io v1.13.0
│ │ │ ├── async-lock v2.8.0
│ │ │ │ └── event-listener v2.5.3
│ │ │ ├── cfg-if v1.0.0
│ │ │ ├── concurrent-queue v2.4.0
│ │ │ │ └── crossbeam-utils v0.8.19
│ │ │ ├── futures-lite v1.13.0
│ │ │ │ ├── fastrand v1.9.0
│ │ │ │ ├── futures-core v0.3.30
│ │ │ │ ├── futures-io v0.3.30
│ │ │ │ ├── memchr v2.7.1
│ │ │ │ ├── parking v2.2.0
│ │ │ │ ├── pin-project-lite v0.2.13
│ │ │ │ └── waker-fn v1.1.1
│ │ │ ├── log v0.4.21 (*)
│ │ │ ├── parking v2.2.0
│ │ │ ├── polling v2.8.0
│ │ │ │ ├── bitflags v1.3.2
│ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ ├── concurrent-queue v2.4.0 (*)
│ │ │ │ ├── log v0.4.21 (*)
│ │ │ │ ├── pin-project-lite v0.2.13
│ │ │ │ └── windows-sys v0.48.0 (*)
│ │ │ │ [build-dependencies]
│ │ │ │ └── autocfg v1.1.0
│ │ │ ├── rustix v0.37.27
│ │ │ │ ├── bitflags v1.3.2
│ │ │ │ ├── errno v0.3.8
│ │ │ │ │ └── windows-sys v0.52.0 (*)
│ │ │ │ ├── io-lifetimes v1.0.11
│ │ │ │ │ └── windows-sys v0.48.0 (*)
│ │ │ │ └── windows-sys v0.48.0 (*)
│ │ │ ├── slab v0.4.9 (*)
│ │ │ ├── socket2 v0.4.10
│ │ │ │ └── winapi v0.3.9
│ │ │ └── waker-fn v1.1.1
│ │ │ [build-dependencies]
│ │ │ └── autocfg v1.1.0
│ │ ├── async-std v1.12.0
│ │ │ ├── async-channel v1.9.0
│ │ │ │ ├── concurrent-queue v2.4.0 (*)
│ │ │ │ ├── event-listener v2.5.3
│ │ │ │ └── futures-core v0.3.30
│ │ │ ├── async-global-executor v2.4.1
│ │ │ │ ├── async-channel v2.2.0
│ │ │ │ │ ├── concurrent-queue v2.4.0 (*)
│ │ │ │ │ ├── event-listener v5.2.0
│ │ │ │ │ │ ├── concurrent-queue v2.4.0 (*)
│ │ │ │ │ │ ├── parking v2.2.0
│ │ │ │ │ │ └── pin-project-lite v0.2.13
│ │ │ │ │ ├── event-listener-strategy v0.5.0
│ │ │ │ │ │ ├── event-listener v5.2.0 (*)
│ │ │ │ │ │ └── pin-project-lite v0.2.13
│ │ │ │ │ ├── futures-core v0.3.30
│ │ │ │ │ └── pin-project-lite v0.2.13
│ │ │ │ ├── async-executor v1.8.0
│ │ │ │ │ ├── async-lock v3.3.0
│ │ │ │ │ │ ├── event-listener v4.0.3
│ │ │ │ │ │ │ ├── concurrent-queue v2.4.0 (*)
│ │ │ │ │ │ │ ├── parking v2.2.0
│ │ │ │ │ │ │ └── pin-project-lite v0.2.13
│ │ │ │ │ │ ├── event-listener-strategy v0.4.0
│ │ │ │ │ │ │ ├── event-listener v4.0.3 (*)
│ │ │ │ │ │ │ └── pin-project-lite v0.2.13
│ │ │ │ │ │ └── pin-project-lite v0.2.13
│ │ │ │ │ ├── async-task v4.7.0
│ │ │ │ │ ├── concurrent-queue v2.4.0 (*)
│ │ │ │ │ ├── fastrand v2.0.1
│ │ │ │ │ ├── futures-lite v2.3.0
│ │ │ │ │ │ ├── fastrand v2.0.1
│ │ │ │ │ │ ├── futures-core v0.3.30
│ │ │ │ │ │ ├── futures-io v0.3.30
│ │ │ │ │ │ ├── parking v2.2.0
│ │ │ │ │ │ └── pin-project-lite v0.2.13
│ │ │ │ │ └── slab v0.4.9 (*)
│ │ │ │ ├── async-io v2.3.2
│ │ │ │ │ ├── async-lock v3.3.0 (*)
│ │ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ │ ├── concurrent-queue v2.4.0 (*)
│ │ │ │ │ ├── futures-io v0.3.30
│ │ │ │ │ ├── futures-lite v2.3.0 (*)
│ │ │ │ │ ├── parking v2.2.0
│ │ │ │ │ ├── polling v3.5.0
│ │ │ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ │ │ ├── concurrent-queue v2.4.0 (*)
│ │ │ │ │ │ ├── pin-project-lite v0.2.13
│ │ │ │ │ │ ├── tracing v0.1.40 (*)
│ │ │ │ │ │ └── windows-sys v0.52.0 (*)
│ │ │ │ │ ├── rustix v0.38.31
│ │ │ │ │ │ ├── bitflags v2.4.2
│ │ │ │ │ │ ├── errno v0.3.8 (*)
│ │ │ │ │ │ └── windows-sys v0.52.0 (*)
│ │ │ │ │ ├── slab v0.4.9 (*)
│ │ │ │ │ ├── tracing v0.1.40 (*)
│ │ │ │ │ └── windows-sys v0.52.0 (*)
│ │ │ │ ├── async-lock v3.3.0 (*)
│ │ │ │ ├── blocking v1.5.1
│ │ │ │ │ ├── async-channel v2.2.0 (*)
│ │ │ │ │ ├── async-lock v3.3.0 (*)
│ │ │ │ │ ├── async-task v4.7.0
│ │ │ │ │ ├── fastrand v2.0.1
│ │ │ │ │ ├── futures-io v0.3.30
│ │ │ │ │ ├── futures-lite v2.3.0 (*)
│ │ │ │ │ ├── piper v0.2.1
│ │ │ │ │ │ ├── atomic-waker v1.1.2
│ │ │ │ │ │ ├── fastrand v2.0.1
│ │ │ │ │ │ └── futures-io v0.3.30
│ │ │ │ │ └── tracing v0.1.40 (*)
│ │ │ │ ├── futures-lite v2.3.0 (*)
│ │ │ │ └── once_cell v1.19.0
│ │ │ ├── async-io v1.13.0 (*)
│ │ │ ├── async-lock v2.8.0 (*)
│ │ │ ├── crossbeam-utils v0.8.19
│ │ │ ├── futures-core v0.3.30
│ │ │ ├── futures-io v0.3.30
│ │ │ ├── futures-lite v1.13.0 (*)
│ │ │ ├── kv-log-macro v1.0.7
│ │ │ │ └── log v0.4.21 (*)
│ │ │ ├── log v0.4.21 (*)
│ │ │ ├── memchr v2.7.1
│ │ │ ├── once_cell v1.19.0
│ │ │ ├── pin-project-lite v0.2.13
│ │ │ ├── pin-utils v0.1.0
│ │ │ └── slab v0.4.9 (*)
│ │ ├── atoi v2.0.0
│ │ │ └── num-traits v0.2.18 (*)
│ │ ├── byteorder v1.5.0
│ │ ├── bytes v1.5.0
│ │ ├── crc v3.0.1
│ │ │ └── crc-catalog v2.4.0
│ │ ├── crossbeam-queue v0.3.11
│ │ │ └── crossbeam-utils v0.8.19
│ │ ├── either v1.10.0
│ │ │ └── serde v1.0.197 (*)
│ │ ├── event-listener v2.5.3
│ │ ├── futures-channel v0.3.30
│ │ │ ├── futures-core v0.3.30
│ │ │ └── futures-sink v0.3.30
│ │ ├── futures-core v0.3.30
│ │ ├── futures-intrusive v0.5.0
│ │ │ ├── futures-core v0.3.30
│ │ │ ├── lock_api v0.4.11 (*)
│ │ │ └── parking_lot v0.12.1 (*)
│ │ ├── futures-io v0.3.30
│ │ ├── futures-util v0.3.30 (*)
│ │ ├── hashlink v0.8.4
│ │ │ └── hashbrown v0.14.3 (*)
│ │ ├── hex v0.4.3
│ │ ├── indexmap v2.2.5 (*)
│ │ ├── log v0.4.21 (*)
│ │ ├── memchr v2.7.1
│ │ ├── native-tls v0.2.11
│ │ │ └── schannel v0.1.23
│ │ │ └── windows-sys v0.52.0 (*)
│ │ ├── once_cell v1.19.0
│ │ ├── paste v1.0.14 (proc-macro)
│ │ ├── percent-encoding v2.3.1
│ │ ├── serde v1.0.197 (*)
│ │ ├── serde_json v1.0.114 (*)
│ │ ├── sha2 v0.10.8
│ │ │ ├── cfg-if v1.0.0
│ │ │ ├── cpufeatures v0.2.12
│ │ │ └── digest v0.10.7 (*)
│ │ ├── smallvec v1.13.1
│ │ ├── sqlformat v0.2.3
│ │ │ ├── itertools v0.12.1
│ │ │ │ └── either v1.10.0 (*)
│ │ │ ├── nom v7.1.3
│ │ │ │ ├── memchr v2.7.1
│ │ │ │ └── minimal-lexical v0.2.1
│ │ │ └── unicode_categories v0.1.1
│ │ ├── thiserror v1.0.58
│ │ │ └── thiserror-impl v1.0.58 (proc-macro)
│ │ │ ├── proc-macro2 v1.0.79 (*)
│ │ │ ├── quote v1.0.35 (*)
│ │ │ └── syn v2.0.53 (*)
│ │ ├── tracing v0.1.40 (*)
│ │ └── url v2.5.0 (*)
│ ├── sqlx-macros v0.7.4 (proc-macro)
│ │ ├── proc-macro2 v1.0.79 (*)
│ │ ├── quote v1.0.35 (*)
│ │ ├── sqlx-core v0.7.4 (*)
│ │ ├── sqlx-macros-core v0.7.4
│ │ │ ├── async-std v1.12.0 (*)
│ │ │ ├── dotenvy v0.15.7
│ │ │ ├── either v1.10.0 (*)
│ │ │ ├── heck v0.4.1
│ │ │ │ └── unicode-segmentation v1.11.0
│ │ │ ├── hex v0.4.3
│ │ │ ├── once_cell v1.19.0
│ │ │ ├── proc-macro2 v1.0.79 (*)
│ │ │ ├── quote v1.0.35 (*)
│ │ │ ├── serde v1.0.197 (*)
│ │ │ ├── serde_json v1.0.114 (*)
│ │ │ ├── sha2 v0.10.8
│ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ ├── cpufeatures v0.2.12
│ │ │ │ └── digest v0.10.7 (*)
│ │ │ ├── sqlx-core v0.7.4 (*)
│ │ │ ├── sqlx-postgres v0.7.4
│ │ │ │ ├── atoi v2.0.0 (*)
│ │ │ │ ├── base64 v0.21.7
│ │ │ │ ├── bitflags v2.4.2
│ │ │ │ ├── byteorder v1.5.0
│ │ │ │ ├── crc v3.0.1 (*)
│ │ │ │ ├── dotenvy v0.15.7
│ │ │ │ ├── etcetera v0.8.0
│ │ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ │ ├── home v0.5.9
│ │ │ │ │ │ └── windows-sys v0.52.0 (*)
│ │ │ │ │ └── windows-sys v0.48.0
│ │ │ │ │ └── windows-targets v0.48.5 (*)
│ │ │ │ ├── futures-channel v0.3.30 (*)
│ │ │ │ ├── futures-core v0.3.30
│ │ │ │ ├── futures-io v0.3.30
│ │ │ │ ├── futures-util v0.3.30 (*)
│ │ │ │ ├── hex v0.4.3
│ │ │ │ ├── hkdf v0.12.4
│ │ │ │ │ └── hmac v0.12.1
│ │ │ │ │ └── digest v0.10.7 (*)
│ │ │ │ ├── hmac v0.12.1 (*)
│ │ │ │ ├── home v0.5.9 (*)
│ │ │ │ ├── itoa v1.0.10
│ │ │ │ ├── log v0.4.21 (*)
│ │ │ │ ├── md-5 v0.10.6
│ │ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ │ └── digest v0.10.7 (*)
│ │ │ │ ├── memchr v2.7.1
│ │ │ │ ├── once_cell v1.19.0
│ │ │ │ ├── rand v0.8.5
│ │ │ │ │ ├── rand_chacha v0.3.1 (*)
│ │ │ │ │ └── rand_core v0.6.4 (*)
│ │ │ │ ├── serde v1.0.197 (*)
│ │ │ │ ├── serde_json v1.0.114 (*)
│ │ │ │ ├── sha2 v0.10.8 (*)
│ │ │ │ ├── smallvec v1.13.1
│ │ │ │ ├── sqlx-core v0.7.4 (*)
│ │ │ │ ├── stringprep v0.1.4
│ │ │ │ │ ├── finl_unicode v1.2.0
│ │ │ │ │ ├── unicode-bidi v0.3.15
│ │ │ │ │ └── unicode-normalization v0.1.23 (*)
│ │ │ │ ├── thiserror v1.0.58 (*)
│ │ │ │ ├── tracing v0.1.40 (*)
│ │ │ │ └── whoami v1.5.1
│ │ │ ├── syn v1.0.109 (*)
│ │ │ ├── tempfile v3.10.1
│ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ ├── fastrand v2.0.1
│ │ │ │ └── windows-sys v0.52.0 (*)
│ │ │ └── url v2.5.0
│ │ │ ├── form_urlencoded v1.2.1 (*)
│ │ │ ├── idna v0.5.0 (*)
│ │ │ └── percent-encoding v2.3.1
│ │ └── syn v1.0.109 (*)
│ └── sqlx-postgres v0.7.4
│ ├── atoi v2.0.0 (*)
│ ├── base64 v0.21.7
│ ├── bitflags v2.4.2
│ ├── byteorder v1.5.0
│ ├── crc v3.0.1 (*)
│ ├── dotenvy v0.15.7
│ ├── etcetera v0.8.0 (*)
│ ├── futures-channel v0.3.30 (*)
│ ├── futures-core v0.3.30
│ ├── futures-io v0.3.30
│ ├── futures-util v0.3.30 (*)
│ ├── hex v0.4.3
│ ├── hkdf v0.12.4 (*)
│ ├── hmac v0.12.1 (*)
│ ├── home v0.5.9 (*)
│ ├── itoa v1.0.10
│ ├── log v0.4.21 (*)
│ ├── md-5 v0.10.6 (*)
│ ├── memchr v2.7.1
│ ├── once_cell v1.19.0
│ ├── rand v0.8.5 (*)
│ ├── serde v1.0.197 (*)
│ ├── serde_json v1.0.114 (*)
│ ├── sha2 v0.10.8 (*)
│ ├── smallvec v1.13.1
│ ├── sqlx-core v0.7.4 (*)
│ ├── stringprep v0.1.4 (*)
│ ├── thiserror v1.0.58 (*)
│ ├── tracing v0.1.40 (*)
│ └── whoami v1.5.1
└── uuid v1.7.0
├── getrandom v0.2.12 (*)
└── serde v1.0.197 (*)
Upvotes: 0
Views: 740
Reputation: 21
Okay so I needed to add the uuid
feature of sqlx
. Following that, I had to manually implement the FromRow
trait by:
impl<'r> FromRow<'r, PgRow> for Announcement {
fn from_row(row: &'r PgRow) -> Result<Self, Error> {
let announcement_uid: String = row.try_get("announcement_uid")?;
let info: String = row.try_get("info")?;
let date: String = row.try_get("date")?;
let club_uid: Uuid = row.try_get("club_uid")?;
Ok(Announcement { announcement_uid, info, date, club_uid })
}
}
I hope this helps out anyone with similar issues
Upvotes: 2