Skip to main content

Crate postgresql_derive

Crate postgresql_derive 

Source
Expand description

#[derive(FromRow)] for the postgresql crate.

Decodes a [postgresql::Row] into a struct by looking up each field’s column by name. Column names default to the field name, and can be changed with #[postgresql(rename = "...")] or transformed with a container-level #[postgresql(rename_all = "...")] (snake_case, camelCase, PascalCase, SCREAMING_SNAKE_CASE, lowercase, UPPERCASE).

#[postgresql(default)] makes a missing or NULL column fall back to the field type’s Default instead of erroring.

Derive Macros§

FromRow
Derives [postgresql::FromRow] for a struct with named fields.
Json
Derives json / jsonb encoding and decoding for a type.
ToRow
Derives [postgresql::ToRow] for a struct with named fields.