pub struct LogicalTypeHandle { /* private fields */ }Expand description
DuckDB Logical Type. https://duckdb.org/docs/sql/data_types/overview
Implementations§
Source§impl LogicalTypeHandle
impl LogicalTypeHandle
Sourcepub fn array(child_type: &Self, array_size: u64) -> Self
pub fn array(child_type: &Self, array_size: u64) -> Self
Creates an array type from its child type.
Sourcepub fn decimal_width(&self) -> u8
pub fn decimal_width(&self) -> u8
Retrieves the decimal width Returns 0 if the LogicalType is not a decimal
Sourcepub fn decimal_scale(&self) -> u8
pub fn decimal_scale(&self) -> u8
Retrieves the decimal scale Returns 0 if the LogicalType is not a decimal
Sourcepub fn geometry_crs(&self) -> Option<String>
pub fn geometry_crs(&self) -> Option<String>
Returns the CRS metadata for a GEOMETRY logical type.
Returns None when this logical type is not GEOMETRY or DuckDB does
not carry CRS metadata for the geometry type.
Sourcepub fn struct_type(fields: &[(&str, Self)]) -> Self
pub fn struct_type(fields: &[(&str, Self)]) -> Self
Make a LogicalType for struct
Sourcepub fn union_type(fields: &[(&str, Self)]) -> Self
pub fn union_type(fields: &[(&str, Self)]) -> Self
Make a LogicalType for union
Sourcepub fn id(&self) -> LogicalTypeId
pub fn id(&self) -> LogicalTypeId
Logical type ID
Sourcepub fn try_id(&self) -> Result<LogicalTypeId, u32>
pub fn try_id(&self) -> Result<LogicalTypeId, u32>
Logical type ID, with forward-compatibility awareness.
Returns Ok(LogicalTypeId) for all known ids (including Invalid), and
Err(raw_id) when DuckDB returns an id this wrapper does not yet
recognize.
Sourcepub fn num_children(&self) -> usize
pub fn num_children(&self) -> usize
Logical type children num
Sourcepub fn child_name(&self, idx: usize) -> String
pub fn child_name(&self, idx: usize) -> String
Logical type child name by idx
Invalid UTF-8 bytes are replaced with the Unicode replacement character.
Panics if the logical type is not a struct or union, or if idx is out of range.
Sourcepub fn try_child_name(&self, idx: usize) -> Result<String>
pub fn try_child_name(&self, idx: usize) -> Result<String>
Logical type child name by idx, rejecting invalid UTF-8.
Panics if the logical type is not a struct or union, or if idx is out
of range.
Sourcepub fn child(&self, idx: usize) -> Self
pub fn child(&self, idx: usize) -> Self
Logical type child by idx.
Panics if the logical type has no children, if idx is out of range,
or if the logical type is LogicalTypeId::Unsupported.
Trait Implementations§
Source§impl Debug for LogicalTypeHandle
impl Debug for LogicalTypeHandle
Source§impl Drop for LogicalTypeHandle
impl Drop for LogicalTypeHandle
Source§impl From<LogicalTypeId> for LogicalTypeHandle
impl From<LogicalTypeId> for LogicalTypeHandle
Source§fn from(id: LogicalTypeId) -> Self
fn from(id: LogicalTypeId) -> Self
Create a new LogicalTypeHandle from LogicalTypeId.
§Panics
Panics for LogicalTypeId::Invalid and
LogicalTypeId::Unsupported, which cannot be constructed as valid
logical types.