pub enum SQLiteType {
Integer,
Text,
Blob,
Real,
Numeric,
Any,
}Expand description
Enum representing supported SQLite column types.
These correspond to the SQLite storage classes. Each type maps to specific Rust types and has different capabilities for constraints and features.
§Examples
use drizzle_types::sqlite::SQLiteType;
let int_type = SQLiteType::Integer;
assert_eq!(int_type.to_sql_type(), "INTEGER");
assert!(int_type.is_valid_flag("autoincrement"));
let text_type = SQLiteType::Text;
assert!(text_type.is_valid_flag("json"));
assert!(!text_type.is_valid_flag("autoincrement"));Variants§
Integer
SQLite INTEGER type - stores signed integers up to 8 bytes.
See: https://sqlite.org/datatype3.html#integer_datatype
Supports: primary keys, autoincrement, enums (discriminant storage)
Text
SQLite TEXT type - stores text in UTF-8, UTF-16BE, or UTF-16LE encoding.
See: https://sqlite.org/datatype3.html#text_datatype
Supports: enums (variant name storage), JSON serialization
Blob
SQLite BLOB type - stores binary data exactly as input.
See: https://sqlite.org/datatype3.html#blob_datatype
Supports: JSON serialization, UUID storage
Real
SQLite REAL type - stores floating point values as 8-byte IEEE floating point numbers.
Numeric
SQLite NUMERIC type - stores values as INTEGER, REAL, or TEXT depending on the value.
Any
SQLite ANY type - no type affinity, can store any type of data.
Implementations§
Source§impl SQLiteType
impl SQLiteType
Sourcepub fn from_attribute_name(name: &str) -> Option<Self>
pub fn from_attribute_name(name: &str) -> Option<Self>
Convert from attribute name to enum variant
Handles common attribute names used in the macro system.
Sourcepub const fn to_sql_type(&self) -> &'static str
pub const fn to_sql_type(&self) -> &'static str
Get the SQL type string for this type
Sourcepub fn is_valid_flag(&self, flag: &str) -> bool
pub fn is_valid_flag(&self, flag: &str) -> bool
Check if a flag is valid for this column type
§Valid Flags per Type
INTEGER:primary,primary_key,unique,autoincrement,enumTEXT:primary,primary_key,unique,json,enumBLOB:primary,primary_key,unique,jsonREAL:primary,primary_key,uniqueNUMERIC:primary,primary_key,uniqueANY:primary,primary_key,unique
Trait Implementations§
Source§impl Clone for SQLiteType
impl Clone for SQLiteType
Source§fn clone(&self) -> SQLiteType
fn clone(&self) -> SQLiteType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more