pub enum SqlType {
}Expand description
A SQL data type used during semantic analysis.
Type names follow ISO SQL standards:
Int32displays as “INTEGER”Int64displays as “BIGINT”Float32displays as “REAL”Float64displays as “DOUBLE PRECISION”Varchardisplays as “VARCHAR”Varbinarydisplays as “VARBINARY”
Variants§
Bool
Boolean type (BOOLEAN)
Int32
32-bit signed integer (INTEGER)
Int64
64-bit signed integer (BIGINT)
Uint32
32-bit unsigned integer (UINTEGER) - extension
Uint64
64-bit unsigned integer (UBIGINT) - extension
Float32
32-bit floating point (REAL)
Float64
64-bit floating point (DOUBLE PRECISION)
Numeric
Fixed-precision decimal (NUMERIC/DECIMAL)
Varchar
Variable-length character string (VARCHAR)
Varbinary
Variable-length binary data (VARBINARY)
Date
Date (year, month, day)
Time
Time of day
Datetime
Date and time without timezone (TIMESTAMP WITHOUT TIME ZONE)
Timestamp
Date and time with timezone (TIMESTAMP WITH TIME ZONE)
Interval
Time interval
Array(Box<SqlType>)
Array of elements
Struct(Vec<StructField>)
Struct with named fields (ROW type in standard SQL)
Json
JSON data
Range(Box<SqlType>)
Range of values
Uuid
Universally unique identifier (UUID)
Unknown
Unknown type (for unresolved expressions)
Any
Any type (for polymorphic functions)
Implementations§
Source§impl SqlType
impl SqlType
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check if this type is numeric.
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Check if this type is an integer type (signed or unsigned).
Sourcepub fn is_signed_integer(&self) -> bool
pub fn is_signed_integer(&self) -> bool
Check if this type is a signed integer type.
Sourcepub fn is_unsigned_integer(&self) -> bool
pub fn is_unsigned_integer(&self) -> bool
Check if this type is an unsigned integer type.
Sourcepub fn is_floating_point(&self) -> bool
pub fn is_floating_point(&self) -> bool
Check if this type is a floating-point type.
Sourcepub fn is_datetime(&self) -> bool
pub fn is_datetime(&self) -> bool
Check if this type is a date/time type.
Sourcepub fn is_comparable_with(&self, other: &SqlType) -> bool
pub fn is_comparable_with(&self, other: &SqlType) -> bool
Check if this type is comparable with another type.
Sourcepub fn can_coerce_to(&self, target: &SqlType) -> bool
pub fn can_coerce_to(&self, target: &SqlType) -> bool
Check if this type can be implicitly coerced to another type.
Sourcepub fn common_supertype(&self, other: &SqlType) -> Option<SqlType>
pub fn common_supertype(&self, other: &SqlType) -> Option<SqlType>
Get the common supertype of two types.
Sourcepub fn element_type(&self) -> Option<&SqlType>
pub fn element_type(&self) -> Option<&SqlType>
Get the element type if this is an array.
Sourcepub fn struct_fields(&self) -> Option<&[StructField]>
pub fn struct_fields(&self) -> Option<&[StructField]>
Get struct fields if this is a struct.