pub struct TypeDef {
pub name: String,
pub is_builtin: bool,
pub not_null: bool,
pub is_domain: bool,
pub sql: String,
pub domain_checks: Vec<DomainConstraint>,
pub kind: TypeDefKind,
}Fields§
§name: String§is_builtin: bool§not_null: bool§is_domain: boolWhether this is a domain (CREATE DOMAIN) vs a custom type (CREATE TYPE).
sql: StringOriginal SQL for round-trip persistence. Stored verbatim from creation.
domain_checks: Vec<DomainConstraint>CHECK constraints from CREATE DOMAIN, stored as first-class data. Empty for regular CREATE TYPE definitions.
kind: TypeDefKindImplementations§
Source§impl TypeDef
impl TypeDef
Sourcepub fn struct_def(&self) -> Option<&StructDef>
pub fn struct_def(&self) -> Option<&StructDef>
Returns the StructDef if this is a STRUCT type.
Sourcepub fn params(&self) -> &[TypeParam]
pub fn params(&self) -> &[TypeParam]
Returns the params (Custom types only, empty for Struct/Union).
Sourcepub fn operators(&self) -> &[TypeOperator]
pub fn operators(&self) -> &[TypeOperator]
Returns the operators (Custom types only, empty for Struct/Union).
Sourcepub fn default_expr(&self) -> Option<&Expr>
pub fn default_expr(&self) -> Option<&Expr>
Returns the default expression (Custom types only).
Sourcepub fn find_struct_field(&self, name: &str) -> Option<(usize, &StructFieldDef)>
pub fn find_struct_field(&self, name: &str) -> Option<(usize, &StructFieldDef)>
Find a struct field by name. Returns (field_index, &StructFieldDef).
Sourcepub fn resolve_union_tag_index(&self, tag_name: &str) -> Option<u8>
pub fn resolve_union_tag_index(&self, tag_name: &str) -> Option<u8>
Resolve a tag name to its numeric index within this union type. Returns None if this is not a union or the variant doesn’t exist.
Sourcepub fn find_union_variant(&self, name: &str) -> Option<(u8, &UnionVariantDef)>
pub fn find_union_variant(&self, name: &str) -> Option<(u8, &UnionVariantDef)>
Find a union variant by tag name. Returns (tag_index, &UnionVariantDef).
Sourcepub fn from_create_type(
type_name: &str,
body: &CreateTypeBody,
is_builtin: bool,
sql: String,
) -> Result<Self>
pub fn from_create_type( type_name: &str, body: &CreateTypeBody, is_builtin: bool, sql: String, ) -> Result<Self>
Construct a TypeDef from a parsed CREATE TYPE statement.
Sourcepub fn from_domain(
domain_name: &str,
base_type: &str,
not_null: bool,
constraints: &[DomainConstraint],
default: Option<Box<Expr>>,
sql: String,
) -> Self
pub fn from_domain( domain_name: &str, base_type: &str, not_null: bool, constraints: &[DomainConstraint], default: Option<Box<Expr>>, sql: String, ) -> Self
Construct a TypeDef from a parsed CREATE DOMAIN statement. Stores constraints as first-class data for propagation to table CHECK constraints.
Sourcepub fn value_input_type(&self) -> &str
pub fn value_input_type(&self) -> &str
The expected input type for value in this custom type.
Looks for a value parameter with a type annotation.
Falls back to base type if value is not declared.
Sourcepub fn user_params(&self) -> impl Iterator<Item = &TypeParam>
pub fn user_params(&self) -> impl Iterator<Item = &TypeParam>
The non-value params (user-provided at column declaration time).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TypeDef
impl RefUnwindSafe for TypeDef
impl Send for TypeDef
impl Sync for TypeDef
impl Unpin for TypeDef
impl UnsafeUnpin for TypeDef
impl UnwindSafe for TypeDef
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,
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