Conversions to and from Postgres types.
This crate is used by the tokio-postgres and postgres crates. You normally don't need to depend directly on it
unless you want to define your own ToSql or FromSql definitions.
Derive
If the derive cargo feature is enabled, you can derive ToSql and FromSql implementations for custom Postgres
types.
Enums
Postgres enums correspond to C-like enums in Rust:
(
'Sad',
'Ok',
'Happy'
);
#
use ;
#
Domains
Postgres domains correspond to tuple structs with one member in Rust:
(octet_length(VALUE) = 16);
#
use ;
#
;
Composites
Postgres composite types correspond to structs in Rust:
(
name TEXT,
supplier_id INT,
price DOUBLE PRECISION
);
#
use ;
#
Naming
The derived implementations will enforce exact matches of type, field, and variant names between the Rust and
Postgres types. The #[postgres(name = "...")] attribute can be used to adjust the name on a type, variant, or
field:
(
'sad',
'ok',
'happy'
);
#
use ;
#