pub struct VbrSchemaDefinition {
pub base: SchemaDefinition,
pub primary_key: Vec<String>,
pub foreign_keys: Vec<ForeignKeyDefinition>,
pub indexes: Vec<IndexDefinition>,
pub unique_constraints: Vec<UniqueConstraint>,
pub auto_generation: HashMap<String, AutoGenerationRule>,
pub many_to_many: Vec<ManyToManyDefinition>,
}Expand description
VBR-specific schema metadata that extends SchemaDefinition
Fields§
§base: SchemaDefinitionBase schema definition from mockforge-data
primary_key: Vec<String>Primary key field name(s)
foreign_keys: Vec<ForeignKeyDefinition>Foreign key relationships
indexes: Vec<IndexDefinition>Index definitions
unique_constraints: Vec<UniqueConstraint>Unique constraints
auto_generation: HashMap<String, AutoGenerationRule>Auto-generation rules for fields
many_to_many: Vec<ManyToManyDefinition>Many-to-many relationships
Implementations§
Source§impl VbrSchemaDefinition
impl VbrSchemaDefinition
Sourcepub fn new(base: SchemaDefinition) -> Self
pub fn new(base: SchemaDefinition) -> Self
Create a new VBR schema definition from a base schema
Sourcepub fn with_primary_key(self, fields: Vec<String>) -> Self
pub fn with_primary_key(self, fields: Vec<String>) -> Self
Set the primary key field(s)
Sourcepub fn with_foreign_key(self, fk: ForeignKeyDefinition) -> Self
pub fn with_foreign_key(self, fk: ForeignKeyDefinition) -> Self
Add a foreign key relationship
Sourcepub fn with_index(self, index: IndexDefinition) -> Self
pub fn with_index(self, index: IndexDefinition) -> Self
Add an index
Sourcepub fn with_unique_constraint(self, constraint: UniqueConstraint) -> Self
pub fn with_unique_constraint(self, constraint: UniqueConstraint) -> Self
Add a unique constraint
Sourcepub fn with_auto_generation(
self,
field: String,
rule: AutoGenerationRule,
) -> Self
pub fn with_auto_generation( self, field: String, rule: AutoGenerationRule, ) -> Self
Set auto-generation rule for a field
Sourcepub fn with_many_to_many(self, m2m: ManyToManyDefinition) -> Self
pub fn with_many_to_many(self, m2m: ManyToManyDefinition) -> Self
Add a many-to-many relationship
Trait Implementations§
Source§impl Clone for VbrSchemaDefinition
impl Clone for VbrSchemaDefinition
Source§fn clone(&self) -> VbrSchemaDefinition
fn clone(&self) -> VbrSchemaDefinition
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 VbrSchemaDefinition
impl Debug for VbrSchemaDefinition
Source§impl<'de> Deserialize<'de> for VbrSchemaDefinition
impl<'de> Deserialize<'de> for VbrSchemaDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for VbrSchemaDefinition
impl RefUnwindSafe for VbrSchemaDefinition
impl Send for VbrSchemaDefinition
impl Sync for VbrSchemaDefinition
impl Unpin for VbrSchemaDefinition
impl UnwindSafe for VbrSchemaDefinition
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: 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>
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