pub enum FieldType {
}Variants§
U32
U64
I32
I64
F64
Bool
String
Uuid
Timestamp
Json
JSON value stored as its serialized bytes in a variable-length column,
typed serde_json::Value in generated Rust (#json). Rides the same
variable-column storage path as String.
Decimal
Exact fixed-point decimal (money/quantity). Typed rust_decimal::Decimal
in generated Rust; stored in a FIXED 16-byte column (via Decimal::serialize),
exactly like Uuid. Serialized as a JSON string to preserve precision.
Ord+Hash, so it is filterable/sortable/indexable (index key normalized
to be scale-invariant). Bare decimal only — decimal(p, s) is deferred.
Enum(String)
A reference to a user-declared top-level enum Name { ... } by its bare
PascalCase name (#enum). Typed as the generated Rust enum in database.rs,
serialized as the variant NAME string (so REST/TS/JSON all agree). Stored in
a FIXED 1-byte u8 discriminant column (variants map to 0..N in declaration
order). Ord+Hash, so it is filterable/sortable/indexable (index key = the
variant name string). A bare PascalCase identifier that is NOT a declared enum
stays a StructType and is caught by struct-reference validation.
Char(usize)
FixedArray(Box<FieldType>, usize)
StructType(String)
OptionalStructType(String)
Nullable(Box<FieldType>)
Nullable wrapper for primitive/scalar types (e.g. age: ?i32 or age: i32?)
Relation(RelationType)
Component(ComponentReference)
Implementations§
Source§impl FieldType
impl FieldType
pub fn to_rust_type(&self) -> String
pub fn is_auto_incrementable(&self) -> bool
pub fn is_auto_generatable(&self) -> bool
pub fn is_relation(&self) -> bool
Sourcepub fn is_fixed_size(&self) -> bool
pub fn is_fixed_size(&self) -> bool
Check if this type is fixed-size (Sprint 8)
Sourcepub fn struct_name(&self) -> Option<&str>
pub fn struct_name(&self) -> Option<&str>
Get struct name if this is a struct type (Sprint 8)
Sourcepub fn enum_name(&self) -> Option<&str>
pub fn enum_name(&self) -> Option<&str>
Get the enum name if this is (or wraps) an enum reference (#enum).
Sourcepub fn size_in_bytes(&self, schema: &Schema) -> usize
pub fn size_in_bytes(&self, schema: &Schema) -> usize
Get the size in bytes for fixed-size types (Sprint 8)
Sourcepub fn alignment(&self, schema: &Schema) -> usize
pub fn alignment(&self, schema: &Schema) -> usize
Get alignment requirement for this type (Sprint 8)
Sourcepub fn supports_range_queries(&self) -> bool
pub fn supports_range_queries(&self) -> bool
Determine if this type supports range queries (ordered)
Sourcepub fn default_index_type(&self) -> IndexType
pub fn default_index_type(&self) -> IndexType
Get the default index type for this field type