pub enum Type {
Show 30 variants
Array(Box<Type>),
Bool,
Bytea,
Char,
Date,
Float4,
Float8,
Int2,
Int4,
Int8,
Interval {
constraints: Option<IntervalConstraints>,
},
Json,
Jsonb,
List(Box<Type>),
Map {
value_type: Box<Type>,
},
Numeric {
constraints: Option<NumericConstraints>,
},
Oid,
Record(Vec<Type>),
Text,
BpChar {
length: Option<CharLength>,
},
VarChar {
max_length: Option<CharLength>,
},
Time {
precision: Option<TimePrecision>,
},
TimeTz {
precision: Option<TimePrecision>,
},
Timestamp {
precision: Option<TimestampPrecision>,
},
TimestampTz {
precision: Option<TimestampPrecision>,
},
Uuid,
RegProc,
RegType,
RegClass,
Int2Vector,
}
Expand description
Variants
Array(Box<Type>)
A variable-length multidimensional array of values.
Bool
A boolean value.
Bytea
A byte array, i.e., a variable-length binary string.
Char
A single-byte character.
Date
A date.
Float4
A 4-byte floating point number.
Float8
An 8-byte floating point number.
Int2
A 2-byte signed integer.
Int4
A 4-byte signed integer.
Int8
An 8-byte signed integer.
Interval
Fields
constraints: Option<IntervalConstraints>
Optional constraints on the type.
A time interval.
Json
A textual JSON blob.
Jsonb
A binary JSON blob.
List(Box<Type>)
A sequence of homogeneous values.
Map
A map with text keys and homogeneous values.
Numeric
Fields
constraints: Option<NumericConstraints>
Optional constraints on the type.
An arbitrary precision number.
Oid
An object identifier.
Record(Vec<Type>)
A sequence of heterogeneous values.
Text
A variable-length string.
BpChar
Fields
length: Option<CharLength>
The length of the string.
If unspecified, the type represents a variable-length string.
A (usually) fixed-length string.
VarChar
Fields
max_length: Option<CharLength>
An optional maximum length to enforce, in characters.
A variable-length string with an optional limit.
Time
Fields
precision: Option<TimePrecision>
An optional precision for the fractional digits in the second field.
A time of day without a day.
TimeTz
Fields
precision: Option<TimePrecision>
An optional precision for the fractional digits in the second field.
A time with a time zone.
Timestamp
Fields
precision: Option<TimestampPrecision>
An optional precision for the fractional digits in the second field.
A date and time, without a timezone.
TimestampTz
Fields
precision: Option<TimestampPrecision>
An optional precision for the fractional digits in the second field.
A date and time, with a timezone.
Uuid
A universally unique identifier.
RegProc
A function name.
RegType
A type name.
RegClass
A class name.
Int2Vector
A small int vector.
Implementations
sourceimpl Type
impl Type
sourcepub fn from_oid(oid: u32) -> Result<Type, TypeFromOidError>
pub fn from_oid(oid: u32) -> Result<Type, TypeFromOidError>
Returns the type corresponding to the provided OID, if the OID is known.
sourcepub fn from_oid_and_typmod(
oid: u32,
typmod: i32
) -> Result<Type, TypeFromOidError>
pub fn from_oid_and_typmod(
oid: u32,
typmod: i32
) -> Result<Type, TypeFromOidError>
pub(crate) fn inner(&self) -> &'static Type
sourcepub fn catalog_name(&self) -> &'static str
pub fn catalog_name(&self) -> &'static str
Returns the item’s name in a way that guarantees it’s resolvable in the catalog.
sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Returns the user-friendly name that PostgreSQL uses for this type.
sourcepub fn constraint(&self) -> Option<&dyn TypeConstraint>
pub fn constraint(&self) -> Option<&dyn TypeConstraint>
Returns the constraint on the type, if any.
sourcepub fn typlen(&self) -> i16
pub fn typlen(&self) -> i16
Returns the number of bytes in the binary representation of this type, or -1 if the type has a variable-length representation.
sourcepub fn typmod(&self) -> i32
pub fn typmod(&self) -> i32
Returns the packed type modifier (“typmod”) for the type.
The typmod is a 32-bit integer associated with the type that encodes
optional constraints on the type. For example, the typmod on
Type::VarChar
encodes an optional constraint on the value’s length.
Most types are never associated with a typmod.
Negative typmods indicate no constraint.
Trait Implementations
sourceimpl From<&ScalarType> for Type
impl From<&ScalarType> for Type
sourcefn from(typ: &ScalarType) -> Type
fn from(typ: &ScalarType) -> Type
Converts to this type from the input type.
sourceimpl TryFrom<&Type> for ScalarType
impl TryFrom<&Type> for ScalarType
type Error = TypeConversionError
type Error = TypeConversionError
The type returned in the event of a conversion error.
sourcefn try_from(typ: &Type) -> Result<ScalarType, TypeConversionError>
fn try_from(typ: &Type) -> Result<ScalarType, TypeConversionError>
Performs the conversion.
impl Eq for Type
impl StructuralEq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> DisplayExt for T where
T: Display,
impl<T> DisplayExt for T where
T: Display,
sourcefn to_string_alt(&self) -> String
fn to_string_alt(&self) -> String
Formats an object with the “alternative” format ({:#}
) and returns it.
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<P, R> ProtoType<R> for P where
R: RustType<P>,
impl<P, R> ProtoType<R> for P where
R: RustType<P>,
sourcefn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See RustType::from_proto
.
sourcefn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See RustType::into_proto
.
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more