I have a Postgres table having three fields
id
which is a bigserial
, meta
a jsonb
field and a uuid UUID
field.
pub struct MetaLogs {
pub id:i64,
pub uuid: <what type should I give here >
pub meta: < What type should I give here >
}
I am using sqlx
ORM for Rust
.
Although I understood that I have to add
features = [ "runtime-tokio", "macros" ,"postgres","json","uuid"]
I was unable to figure it out how to proceed after that
sqlx
provides bothJson
andUuid
type implementations for PostgreSQL. See uuid.rs and json.rs.Note the Json type will resolve to jsonb internally which is as you'd expect.
Sample: