pub struct ParsedSqlType {
pub base_type: String,
pub length: Option<u32>,
pub precision: Option<u32>,
pub scale: Option<u32>,
pub unsigned: bool,
pub array: bool,
}Expand description
Parsed SQL type with extracted metadata.
Fields§
§base_type: StringBase type name (e.g., VARCHAR, INTEGER, DECIMAL)
length: Option<u32>Length for character types (e.g., VARCHAR(255) -> 255)
precision: Option<u32>Precision for numeric types (e.g., DECIMAL(10,2) -> 10)
scale: Option<u32>Scale for numeric types (e.g., DECIMAL(10,2) -> 2)
unsigned: boolWhether the type is unsigned (MySQL)
array: boolWhether this is an array type (PostgreSQL)
Implementations§
Source§impl ParsedSqlType
impl ParsedSqlType
Sourcepub fn parse(type_str: &str) -> Self
pub fn parse(type_str: &str) -> Self
Parse a SQL type string into structured metadata.
§Examples
VARCHAR(255)-> base_type: “VARCHAR”, length: 255DECIMAL(10,2)-> base_type: “DECIMAL”, precision: 10, scale: 2INT UNSIGNED-> base_type: “INT”, unsigned: trueTEXT[]-> base_type: “TEXT”, array: true
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check if this is a numeric type.
Sourcepub fn is_datetime(&self) -> bool
pub fn is_datetime(&self) -> bool
Check if this is a date/time type.
Trait Implementations§
Source§impl Clone for ParsedSqlType
impl Clone for ParsedSqlType
Source§fn clone(&self) -> ParsedSqlType
fn clone(&self) -> ParsedSqlType
Returns a duplicate 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 ParsedSqlType
impl Debug for ParsedSqlType
Source§impl Default for ParsedSqlType
impl Default for ParsedSqlType
Source§fn default() -> ParsedSqlType
fn default() -> ParsedSqlType
Returns the “default value” for a type. Read more
Source§impl PartialEq for ParsedSqlType
impl PartialEq for ParsedSqlType
impl Eq for ParsedSqlType
impl StructuralPartialEq for ParsedSqlType
Auto Trait Implementations§
impl Freeze for ParsedSqlType
impl RefUnwindSafe for ParsedSqlType
impl Send for ParsedSqlType
impl Sync for ParsedSqlType
impl Unpin for ParsedSqlType
impl UnsafeUnpin for ParsedSqlType
impl UnwindSafe for ParsedSqlType
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).