Skip to main content

StaticType

Trait StaticType 

Source
pub trait StaticType {
    const OID: Oid;
    const NULLABLE: bool = false;
}
Expand description

A value with a statically known PostgreSQL type OID.

Used by the query! / query_as! macros to check parameter types at compile time. This trait is deliberately separate from ToSql because an associated constant would make ToSql not object-safe.

Required Associated Constants§

Source

const OID: Oid

The PostgreSQL type OID of this Rust type.

Provided Associated Constants§

Source

const NULLABLE: bool = false

Whether this Rust type can represent SQL NULL (i.e. it is Option).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl StaticType for DateTime

Source§

const OID: Oid = TIMESTAMPTZOID

Source§

impl StaticType for IpNetwork

Source§

const OID: Oid = INETOID

Source§

impl StaticType for String

Source§

const OID: Oid = TEXTOID

Source§

impl StaticType for Uuid

Source§

const OID: Oid = UUIDOID

Source§

impl StaticType for Value

Source§

const OID: Oid = JSONBOID

Source§

impl StaticType for Vec<u8>

Source§

const OID: Oid = BYTEAOID

Source§

impl StaticType for [u8]

Source§

const OID: Oid = BYTEAOID

Source§

impl StaticType for bool

Source§

const OID: Oid = BOOLOID

Source§

impl StaticType for f32

Source§

const OID: Oid = FLOAT4OID

Source§

impl StaticType for f64

Source§

const OID: Oid = FLOAT8OID

Source§

impl StaticType for i16

Source§

const OID: Oid = INT2OID

Source§

impl StaticType for i32

Source§

const OID: Oid = INT4OID

Source§

impl StaticType for i64

Source§

const OID: Oid = INT8OID

Source§

impl StaticType for str

Source§

const OID: Oid = TEXTOID

Source§

impl<T: StaticType + ?Sized> StaticType for &T

Source§

const OID: Oid = T::OID

Source§

const NULLABLE: bool = T::NULLABLE

Source§

impl<T: StaticType> StaticType for Option<T>

Source§

const OID: Oid = T::OID

Source§

const NULLABLE: bool = true

Source§

impl<T: StaticType> StaticType for Vec<T>

Source§

impl<T: StaticType> StaticType for [T]

Implementors§

Source§

impl StaticType for Date

Source§

const OID: Oid = DATEOID

Source§

impl StaticType for Interval

Source§

const OID: Oid = INTERVALOID

Source§

impl StaticType for Timestamp

Source§

const OID: Oid = TIMESTAMPOID

Source§

impl<I, T> StaticType for Array<I>
where I: Iterator<Item = T> + Send, T: ToSql + StaticType,

Source§

impl<T> StaticType for Json<T>

Source§

const OID: Oid = JSONBOID