pub trait IntoDatum {
    fn into_datum(self) -> Option<Datum>;
    fn type_oid() -> Oid;

    fn array_type_oid() -> Oid { ... }
}
Expand description

Convert a Rust type into a pg_sys::Datum.

Default implementations are provided for the common Rust types.

If implementing this, also implement FromDatum for the reverse conversion.

Note that any conversions that need to allocate memory (ie, for a varlena * representation of a Rust type, that memory must be allocated within a PgMemoryContexts.

Required Methods

Provided Methods

Implementations on Foreign Types

for supporting NULL as the None value of an Option

for bool

for “char”

for smallint

for integer

for oid

for bigint

for real

for double precision

for text, varchar

for cstring

Safety

The &CStr better be allocated by Postgres

for bytea

for NULL – always converts to None

Implementors

for json

for jsonb

for jsonstring

for user types