pub struct ConstraintValidator;Expand description
Constraint validator for table creation and alteration
Implementations§
Source§impl ConstraintValidator
impl ConstraintValidator
Sourcepub fn process_constraints(
columns: &[ColumnDef],
table_constraints: &[TableConstraint],
) -> Result<ConstraintResult, ExecutorError>
pub fn process_constraints( columns: &[ColumnDef], table_constraints: &[TableConstraint], ) -> Result<ConstraintResult, ExecutorError>
Process all constraints from column definitions and table constraints
§Arguments
columns- The column definitions from the DDL statementtable_constraints- The table-level constraints
§Returns
A ConstraintResult containing all processed constraints, or an error if validation fails
§Errors
Returns ExecutorError::MultiplePrimaryKeys if multiple PRIMARY KEY constraints are defined
Sourcepub fn apply_to_columns(
columns: &mut [ColumnSchema],
constraint_result: &ConstraintResult,
)
pub fn apply_to_columns( columns: &mut [ColumnSchema], constraint_result: &ConstraintResult, )
Apply constraint results to a mutable column list
This updates column nullability based on NOT NULL and PRIMARY KEY constraints
§Arguments
columns- The column schemas to updateconstraint_result- The constraint processing results
Sourcepub fn apply_to_schema(
table_schema: &mut TableSchema,
constraint_result: &ConstraintResult,
)
pub fn apply_to_schema( table_schema: &mut TableSchema, constraint_result: &ConstraintResult, )
Apply constraint results to a table schema
This sets the primary key, unique constraints, and check constraints on the schema
§Arguments
table_schema- The table schema to updateconstraint_result- The constraint processing results
Auto Trait Implementations§
impl Freeze for ConstraintValidator
impl RefUnwindSafe for ConstraintValidator
impl Send for ConstraintValidator
impl Sync for ConstraintValidator
impl Unpin for ConstraintValidator
impl UnwindSafe for ConstraintValidator
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> 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>
Converts
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>
Converts
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