Enum mz_pgrepr::types::Type

source ·
pub enum Type {
Show 38 variants Array(Box<Type>), Bool, Bytea, Char, Date, Float4, Float8, Int2, Int4, Int8, UInt2, UInt4, UInt8, Interval { constraints: Option<IntervalConstraints>, }, Json, Jsonb, List(Box<Type>), Map { value_type: Box<Type>, }, Name, 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, MzTimestamp, Range { element_type: Box<Type>, }, MzAclItem, AclItem,
}
Expand description

The type of a Value.

The Display representation of a type is guaranteed to be valid PostgreSQL syntax that names the type and any modifiers.

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.

§

UInt2

A 2-byte unsigned integer. This does not exist in PostgreSQL.

§

UInt4

A 4-byte unsigned integer. This does not exist in PostgreSQL.

§

UInt8

An 8-byte unsigned integer. This does not exist in PostgreSQL.

§

Interval

A time interval.

Fields

§constraints: Option<IntervalConstraints>

Optional constraints on the type.

§

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.

Fields

§value_type: Box<Type>

The type of the values in the map.

§

Name

A character type for storing identifiers of no more than 64 bytes in length.

§

Numeric

An arbitrary precision number.

Fields

§constraints: Option<NumericConstraints>

Optional constraints on the type.

§

Oid

An object identifier.

§

Record(Vec<Type>)

A sequence of heterogeneous values.

§

Text

A variable-length string.

§

BpChar

A (usually) fixed-length string.

Fields

§length: Option<CharLength>

The length of the string.

If unspecified, the type represents a variable-length string.

§

VarChar

A variable-length string with an optional limit.

Fields

§max_length: Option<CharLength>

An optional maximum length to enforce, in characters.

§

Time

A time of day without a day.

Fields

§precision: Option<TimePrecision>

An optional precision for the fractional digits in the second field.

§

TimeTz

A time with a time zone.

Fields

§precision: Option<TimePrecision>

An optional precision for the fractional digits in the second field.

§

Timestamp

A date and time, without a timezone.

Fields

§precision: Option<TimestampPrecision>

An optional precision for the fractional digits in the second field.

§

TimestampTz

A date and time, with a timezone.

Fields

§precision: Option<TimestampPrecision>

An optional precision for the fractional digits in the second field.

§

Uuid

A universally unique identifier.

§

RegProc

A function name.

§

RegType

A type name.

§

RegClass

A class name.

§

Int2Vector

A small int vector.

§

MzTimestamp

A Materialize timestamp.

§

Range

A range of values of the inner type.

Fields

§element_type: Box<Type>

The domain type.

§

MzAclItem

A list of privileges granted to a user, that uses mz_repr::role_id::RoleIds for role references.

§

AclItem

A list of privileges granted to a user that uses mz_repr::adt::system::Oids for role references. This type is used primarily for compatibility with PostgreSQL.

Implementations§

source§

impl Type

source

pub fn from_oid(oid: u32) -> Result<Type, TypeFromOidError>

Returns the type corresponding to the provided OID, if the OID is known.

source

pub fn from_oid_and_typmod( oid: u32, typmod: i32, ) -> Result<Type, TypeFromOidError>

Returns the Type corresponding to the provided OID and packed type modifier (“typmod”).

For details about typmods, see the typmod method.

§Errors

Returns an error if the OID is unknown or if the typmod is invalid for the type.

source

pub(crate) fn inner(&self) -> &'static Type

source

pub fn catalog_name(&self) -> &'static str

Returns the item’s name in a way that guarantees it’s resolvable in the catalog.

source

pub fn name(&self) -> &'static str

Returns the user-friendly name that PostgreSQL uses for this type.

source

pub fn oid(&self) -> u32

Returns the OID of this type.

source

pub fn constraint(&self) -> Option<&dyn TypeConstraint>

Returns the constraint on the type, if any.

source

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.

source

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§

source§

impl Clone for Type

source§

fn clone(&self) -> Type

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Type

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Type

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&ScalarType> for Type

source§

fn from(typ: &ScalarType) -> Type

Converts to this type from the input type.
source§

impl PartialEq for Type

source§

fn eq(&self, other: &Type) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&Type> for ScalarType

§

type Error = TypeConversionError

The type returned in the event of a conversion error.
source§

fn try_from(typ: &Type) -> Result<ScalarType, TypeConversionError>

Performs the conversion.
source§

impl Eq for Type

source§

impl StructuralPartialEq for Type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl Send for Type

§

impl Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

fn cast_into(self) -> U

Performs the cast.
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CopyAs<T> for T

source§

fn copy_as(self) -> T

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T, U> OverrideFrom<Option<&T>> for U
where U: OverrideFrom<T>,

source§

fn override_from(self, layer: &Option<&T>) -> U

Override the configuration represented by Self with values from the given layer.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ProgressEventTimestamp for T
where T: Data + Debug + Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Upcasts this ProgressEventTimestamp to Any. Read more
source§

fn type_name(&self) -> &'static str

Returns the name of the concrete type of this object. Read more
source§

impl<P, R> ProtoType<R> for P
where R: RustType<P>,

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<'a, S, T> Semigroup<&'a S> for T
where T: Semigroup<S>,

source§

fn plus_equals(&mut self, rhs: &&'a S)

The method of std::ops::AddAssign, for types that do not implement AddAssign.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

source§

impl<T> Data for T
where T: Clone + 'static,