#[non_exhaustive]pub struct ColumnTypeInfo {
pub declared_name: String,
pub array_dimensions: u32,
pub base_type: Option<String>,
pub kind: ColumnTypeKind,
}Expand description
Structured type information for a result column.
Returned by Statement::get_column_type_info. Surfaces the array depth
and custom-type resolution that the SQLite-compat get_column_decltype
API does not expose, and also carries the inferred-affinity result for
computed expressions (SELECT 1+1, function calls in subqueries, etc.)
— the consumer asks one question, the API decides which path applies.
For a direct table-column reference, declared_name is the literal
string the user wrote in CREATE TABLE ("INTEGER", "cents",
"VARCHAR"), array_dimensions is the bracket depth, and base_type /
kind carry any CREATE TYPE / CREATE DOMAIN resolution.
For a literal (SELECT 42, SELECT 'x', SELECT 3.14), declared_name
is the primitive that matches the literal’s parsed value type
("INTEGER", "TEXT", "REAL"). For a typed expression — CAST, rowid,
or anything else SQLite’s affinity rules can pin down — it’s the
inferred primitive. In both cases array_dimensions is 0, base_type
is None, and kind is ColumnTypeKind::Builtin. When neither path
produces a usable primitive (binary arithmetic that SQLite refuses to
propagate through, BLOB literals, NULL literals, function calls without
declared return affinity), get_column_type_info returns Ok(None)
rather than fabricating a name — callers can fall through to their own
default.
New fields may be added over time; the struct is marked
#[non_exhaustive] so consumers must use struct-update or accessor
patterns rather than exhaustive matches.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.declared_name: StringThe declared type name as written in CREATE TABLE — e.g. "INTEGER",
"VARCHAR", or the name of a CREATE TYPE / CREATE DOMAIN such as
"cents". This is the same string get_column_decltype returns.
array_dimensions: u32Array dimensionality: 0 for scalar columns, 1 for INTEGER[],
2 for TEXT[][], etc.
base_type: Option<String>For columns whose declared type resolves to a CREATE TYPE or
CREATE DOMAIN definition, this is the underlying primitive type name
("INTEGER", "TEXT", "REAL", "BLOB", or "NUMERIC"). None
when the declared name is a built-in primitive directly.
Use this to distinguish “the user wrote INTEGER” (base_type: None)
from “the user wrote cents, which happens to be INTEGER underneath”
(base_type: Some("INTEGER")).
kind: ColumnTypeKindClassification of the declared type. Distinguishes BUILTIN (the
declared name is a primitive) from the four CREATE TYPE/CREATE DOMAIN flavours.
This matters for callers like wire-protocol layers that need to map
a column to its native type code: a column declared as a STRUCT
type stores a BLOB on disk (base_type is Some("BLOB")), but the
caller usually wants to expose it as a composite/JSON type rather
than raw bytes. The kind field carries that distinction directly
without forcing the caller to re-query the schema.
Trait Implementations§
Source§impl Clone for ColumnTypeInfo
impl Clone for ColumnTypeInfo
Source§fn clone(&self) -> ColumnTypeInfo
fn clone(&self) -> ColumnTypeInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ColumnTypeInfo
impl Debug for ColumnTypeInfo
impl Eq for ColumnTypeInfo
Source§impl PartialEq for ColumnTypeInfo
impl PartialEq for ColumnTypeInfo
impl StructuralPartialEq for ColumnTypeInfo
Auto Trait Implementations§
impl Freeze for ColumnTypeInfo
impl RefUnwindSafe for ColumnTypeInfo
impl Send for ColumnTypeInfo
impl Sync for ColumnTypeInfo
impl Unpin for ColumnTypeInfo
impl UnsafeUnpin for ColumnTypeInfo
impl UnwindSafe for ColumnTypeInfo
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more