pub struct ColumnType {
pub typ: SqlType,
pub nullable: bool,
pub precision: Option<i64>,
pub scale: Option<i64>,
pub component: Option<Box<ColumnType>>,
pub fields: Option<Vec<Field>>,
pub key: Option<Box<ColumnType>>,
pub value: Option<Box<ColumnType>>,
}Expand description
A SQL column type description.
Matches the Calcite JSON format.
Fields§
§typ: SqlTypeIdentifier for the type (e.g., VARCHAR, BIGINT, ARRAY etc.)
nullable: boolDoes the type accept NULL values?
precision: Option<i64>Precision of the type.
§Examples
VARCHARsets precision to-1.VARCHAR(255)sets precision to255.BIGINT,DATE,FLOAT,DOUBLE,GEOMETRY, etc. sets precision to NoneTIME,TIMESTAMPset precision to0.
scale: Option<i64>§component: Option<Box<ColumnType>>A component of the type (if available).
This is in a Box because it makes it a recursive types.
For example, this would specify the VARCHAR(20) in the VARCHAR(20) ARRAY type.
fields: Option<Vec<Field>>The fields of the type (if available).
For example this would specify the fields of a CREATE TYPE construct.
CREATE TYPE person_typ AS (
firstname VARCHAR(30),
lastname VARCHAR(30),
address ADDRESS_TYP
);Would lead to the following fields value:
[
ColumnType { name: "firstname, ... },
ColumnType { name: "lastname", ... },
ColumnType { name: "address", fields: [ ... ] }
]key: Option<Box<ColumnType>>Key type; must be set when type == "MAP".
value: Option<Box<ColumnType>>Value type; must be set when type == "MAP".
Implementations§
Trait Implementations§
source§impl Clone for ColumnType
impl Clone for ColumnType
source§fn clone(&self) -> ColumnType
fn clone(&self) -> ColumnType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for ColumnType
impl Debug for ColumnType
source§impl<'de> Deserialize<'de> for ColumnType
impl<'de> Deserialize<'de> for ColumnType
source§fn 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
source§impl PartialEq for ColumnType
impl PartialEq for ColumnType
source§impl Serialize for ColumnType
impl Serialize for ColumnType
source§impl<'__s> ToSchema<'__s> for ColumnType
impl<'__s> ToSchema<'__s> for ColumnType
impl Eq for ColumnType
impl StructuralPartialEq for ColumnType
Auto Trait Implementations§
impl Freeze for ColumnType
impl RefUnwindSafe for ColumnType
impl Send for ColumnType
impl Sync for ColumnType
impl Unpin for ColumnType
impl UnwindSafe for ColumnType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.