Enum mz_repr::ScalarType
source · [−]pub enum ScalarType {
Show 28 variants
Bool,
Int16,
Int32,
Int64,
Float32,
Float64,
Numeric {
max_scale: Option<NumericMaxScale>,
},
Date,
Time,
Timestamp,
TimestampTz,
Interval,
PgLegacyChar,
Bytes,
String,
Char {
length: Option<CharLength>,
},
VarChar {
max_length: Option<VarCharMaxLength>,
},
Jsonb,
Uuid,
Array(Box<ScalarType>),
List {
element_type: Box<ScalarType>,
custom_id: Option<GlobalId>,
},
Record {
fields: Vec<(ColumnName, ColumnType)>,
custom_id: Option<GlobalId>,
},
Oid,
Map {
value_type: Box<ScalarType>,
custom_id: Option<GlobalId>,
},
RegProc,
RegType,
RegClass,
Int2Vector,
}
Expand description
The type of a Datum
.
There is a direct correspondence between Datum
variants and ScalarType
variants.
Variants
Bool
The type of Datum::True
and Datum::False
.
Int16
The type of Datum::Int16
.
Int32
The type of Datum::Int32
.
Int64
The type of Datum::Int64
.
Float32
The type of Datum::Float32
.
Float64
The type of Datum::Float64
.
Numeric
Fields
max_scale: Option<NumericMaxScale>
The type of Datum::Numeric
.
Numeric
values cannot exceed NUMERIC_DATUM_MAX_PRECISION
digits of
precision.
This type additionally specifies the maximum scale of the decimal. The scale specifies the number of digits after the decimal point.
Date
The type of Datum::Date
.
Time
The type of Datum::Time
.
Timestamp
The type of Datum::Timestamp
.
TimestampTz
The type of Datum::TimestampTz
.
Interval
The type of Datum::Interval
.
PgLegacyChar
A single byte character type backed by a Datum::UInt8
.
PostgreSQL calls this type "char"
. Note the quotes, which distinguish
it from the type ScalarType::Char
.
Bytes
The type of Datum::Bytes
.
String
The type of Datum::String
.
Char
Fields
length: Option<CharLength>
Stored as Datum::String
, but expresses a fixed-width, blank-padded
string.
Note that a length
of None
is used in special cases, such as
creating lists.
VarChar
Fields
max_length: Option<VarCharMaxLength>
Stored as Datum::String
, but can optionally express a limit on the
string’s length.
Jsonb
The type of a datum that may represent any valid JSON value.
Valid datum variants for this type are:
Uuid
The type of Datum::Uuid
.
Array(Box<ScalarType>)
The type of Datum::Array
.
Elements within the array are of the specified type. It is illegal for
the element type to be itself an array type. Array elements may always
be Datum::Null
.
List
The type of Datum::List
.
Elements within the list are of the specified type. List elements may
always be Datum::Null
.
Record
Fields
fields: Vec<(ColumnName, ColumnType)>
The names and types of the fields of the record, in order from left to right.
An ordered and named sequence of datums.
Oid
A PostgreSQL object identifier.
Map
The type of Datum::Map
Keys within the map are always of type ScalarType::String
.
Values within the map are of the specified type. Values may always
be Datum::Null
.
RegProc
A PostgreSQL function name.
RegType
A PostgreSQL type name.
RegClass
A PostgreSQL class name.
Int2Vector
A vector on small ints; this is a legacy type in PG used primarily in the catalog.
Implementations
sourceimpl<'a> ScalarType
impl<'a> ScalarType
sourcepub fn unwrap_numeric_max_scale(&self) -> Option<NumericMaxScale>
pub fn unwrap_numeric_max_scale(&self) -> Option<NumericMaxScale>
Returns the contained numeric maximum scale.
Panics
Panics if the scalar type is not ScalarType::Numeric
.
sourcepub fn unwrap_list_element_type(&self) -> &ScalarType
pub fn unwrap_list_element_type(&self) -> &ScalarType
Returns the ScalarType
of elements in a ScalarType::List
.
Panics
Panics if called on anything other than a ScalarType::List
.
sourcepub fn unwrap_list_nth_layer_type(&self, layer: usize) -> &ScalarType
pub fn unwrap_list_nth_layer_type(&self, layer: usize) -> &ScalarType
Returns the ScalarType
of elements in the nth layer a
ScalarType::List
.
For example, in an int list list
, the:
- 0th layer is
int list list
- 1st layer is
int list
- 2nd layer is
int
Panics
Panics if the nth-1 layer is anything other than a
ScalarType::List
.
sourcepub fn unwrap_record_element_type(&self) -> Vec<&ScalarType>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn unwrap_record_element_type(&self) -> Vec<&ScalarType>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns vector of ScalarType
elements in a ScalarType::Record
.
Panics
Panics if called on anything other than a ScalarType::Record
.
sourcepub fn unwrap_list_n_layers(&self) -> usize
pub fn unwrap_list_n_layers(&self) -> usize
Returns number of dimensions/axes (also known as “rank”) on a
ScalarType::List
.
Panics
Panics if called on anything other than a ScalarType::List
.
sourcepub fn without_modifiers(&self) -> ScalarType
pub fn without_modifiers(&self) -> ScalarType
Returns self
with any type modifiers removed.
Namely, this should set optional scales or limits to None
.
sourcepub fn unwrap_array_element_type(&self) -> &ScalarType
pub fn unwrap_array_element_type(&self) -> &ScalarType
Returns the ScalarType
of elements in a ScalarType::Array
or the
elements of a vector type, e.g. ScalarType::Int16
for
ScalarType::Int2Vector
.
Panics
Panics if called on anything other than a ScalarType::Array
or
ScalarType::Int2Vector
.
sourcepub fn unwrap_collection_element_type(&self) -> &ScalarType
pub fn unwrap_collection_element_type(&self) -> &ScalarType
Returns the ScalarType
of elements in a ScalarType::Array
,
ScalarType::Int2Vector
, or ScalarType::List
.
Panics
Panics if called on anything other than a ScalarType::Array
,
ScalarType::Int2Vector
, or ScalarType::List
.
sourcepub fn unwrap_map_value_type(&self) -> &ScalarType
pub fn unwrap_map_value_type(&self) -> &ScalarType
Returns the ScalarType
of values in a ScalarType::Map
.
Panics
Panics if called on anything other than a ScalarType::Map
.
sourcepub fn unwrap_char_length(&self) -> Option<CharLength>
pub fn unwrap_char_length(&self) -> Option<CharLength>
Returns the length of a ScalarType::Char
.
Panics
Panics if called on anything other than a ScalarType::Char
.
sourcepub fn unwrap_varchar_max_length(&self) -> Option<VarCharMaxLength>
pub fn unwrap_varchar_max_length(&self) -> Option<VarCharMaxLength>
Returns the max length of a ScalarType::VarChar
.
Panics
Panics if called on anything other than a ScalarType::VarChar
.
sourcepub fn nullable(self, nullable: bool) -> ColumnType
pub fn nullable(self, nullable: bool) -> ColumnType
Derives a column type from this scalar type with the specified nullability.
sourcepub fn is_vec(&self) -> bool
pub fn is_vec(&self) -> bool
Returns whether or not self
is a vector-like type, i.e.
ScalarType::Array
, ScalarType::Int2Vector
, or
ScalarType::List
, irrespective of its element type.
pub fn is_custom_type(&self) -> bool
sourcepub fn base_eq(&self, other: &ScalarType) -> bool
pub fn base_eq(&self, other: &ScalarType) -> bool
Determines equality among scalar types that acknowledges custom OIDs, but ignores other embedded values.
In most situations, you want to use base_eq
rather than ScalarType
’s
implementation of Eq
. base_eq
expresses the semantics of direct type
interoperability whereas Eq
expresses an exact comparison between the
values.
For instance, base_eq
signals that e.g. two ScalarType::Numeric
values can be added together, irrespective of their embedded scale. In
contrast, two Numeric
values with different scales are never Eq
to
one another.
pub fn structural_eq(&self, other: &ScalarType) -> bool
pub fn eq_inner(&self, other: &ScalarType, structure_only: bool) -> bool
Trait Implementations
sourceimpl Arbitrary for ScalarType
impl Arbitrary for ScalarType
type Parameters = ()
type Parameters = ()
The type of parameters that arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
. Read more
type Strategy = BoxedStrategy<ScalarType>
type Strategy = BoxedStrategy<ScalarType>
sourcefn arbitrary_with(_: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_: Self::Parameters) -> Self::Strategy
sourceimpl Clone for ScalarType
impl Clone for ScalarType
sourcefn clone(&self) -> ScalarType
fn clone(&self) -> ScalarType
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ScalarType
impl Debug for ScalarType
sourceimpl<'de> Deserialize<'de> for ScalarType
impl<'de> Deserialize<'de> for ScalarType
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'__enum_kinds1> From<&'__enum_kinds1 ScalarType> for ScalarBaseType
impl<'__enum_kinds1> From<&'__enum_kinds1 ScalarType> for ScalarBaseType
sourcefn from(_value: &'__enum_kinds1 ScalarType) -> Self
fn from(_value: &'__enum_kinds1 ScalarType) -> Self
Converts to this type from the input type.
sourceimpl<'__enum_kinds1> From<ScalarType> for ScalarBaseType
impl<'__enum_kinds1> From<ScalarType> for ScalarBaseType
sourcefn from(value: ScalarType) -> Self
fn from(value: ScalarType) -> Self
Converts to this type from the input type.
sourceimpl Hash for ScalarType
impl Hash for ScalarType
sourceimpl MzReflect for ScalarType
impl MzReflect for ScalarType
sourcefn add_to_reflected_type_info(rti: &mut ReflectedTypeInfo)
fn add_to_reflected_type_info(rti: &mut ReflectedTypeInfo)
Adds names and types of the fields of the struct or enum to rti
. Read more
sourceimpl Ord for ScalarType
impl Ord for ScalarType
sourceimpl PartialEq<ScalarType> for ScalarType
impl PartialEq<ScalarType> for ScalarType
sourcefn eq(&self, other: &ScalarType) -> bool
fn eq(&self, other: &ScalarType) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ScalarType) -> bool
fn ne(&self, other: &ScalarType) -> bool
This method tests for !=
.
sourceimpl PartialOrd<ScalarType> for ScalarType
impl PartialOrd<ScalarType> for ScalarType
sourcefn partial_cmp(&self, other: &ScalarType) -> Option<Ordering>
fn partial_cmp(&self, other: &ScalarType) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl RustType<ProtoScalarType> for ScalarType
impl RustType<ProtoScalarType> for ScalarType
sourcefn into_proto(&self) -> ProtoScalarType
fn into_proto(&self) -> ProtoScalarType
Convert a Self
into a Proto
value.
sourcefn from_proto(proto: ProtoScalarType) -> Result<Self, TryFromProtoError>
fn from_proto(proto: ProtoScalarType) -> Result<Self, TryFromProtoError>
Consume and convert a Proto
back into a Self
value. Read more
sourceimpl Serialize for ScalarType
impl Serialize for ScalarType
impl Eq for ScalarType
impl StructuralEq for ScalarType
impl StructuralPartialEq for ScalarType
Auto Trait Implementations
impl RefUnwindSafe for ScalarType
impl Send for ScalarType
impl Sync for ScalarType
impl Unpin for ScalarType
impl UnwindSafe for ScalarType
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> CallHasher for T where
T: Hash + ?Sized,
impl<T> CallHasher for T where
T: Hash + ?Sized,
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<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
impl<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
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> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
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