#[non_exhaustive]pub enum Annotation {
AutoCreateTime,
AutoUpdateTime,
AutoIncrement,
Choices(Vec<String>),
DefaultValue(DefaultValue),
Index(Option<IndexValue>),
MaxLength(i32),
NotNull,
PrimaryKey,
Unique,
ForeignKey(ForeignKey),
}
Expand description
The subset of annotations which need to be communicated with the migration tool
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AutoCreateTime
Only for DbType::Timestamp, DbType::DateTime, DbType::Time and DbType::Date. Will set the current time of the database when a row is created.
AutoUpdateTime
Only for DbType::Timestamp, DbType::DateTime, DbType::Time and DbType::Date. Will set the current time of the database when a row is updated.
AutoIncrement
AUTO_INCREMENT constraint
Choices(Vec<String>)
A list of choices to set
DefaultValue(DefaultValue)
DEFAULT constraint
Index(Option<IndexValue>)
Create an index. The optional IndexValue can be used, to build more complex indexes.
MaxLength(i32)
Only for VARCHAR, VARBINARY. Specifies the maximum length of the column’s content.
NotNull
NOT NULL constraint
PrimaryKey
The annotated column will be used as primary key
Unique
UNIQUE constraint
ForeignKey(ForeignKey)
Foreign Key constraint
Implementations§
Source§impl Annotation
impl Annotation
Sourcepub fn eq_shallow(&self, other: &Self) -> bool
pub fn eq_shallow(&self, other: &Self) -> bool
Alternative shallow equals function.
Returns true on:
use rorm_declaration::imr::Annotation;
assert!(Annotation::MaxLength(0).eq_shallow(&Annotation::MaxLength(255)));
Sourcepub fn hash_shallow(&self) -> u64
pub fn hash_shallow(&self) -> u64
Alternative shallow hash function.
Returns true on:
use rorm_declaration::imr::Annotation;
assert_eq!(Annotation::MaxLength(0).hash_shallow(), Annotation::MaxLength(255).hash_shallow());
Trait Implementations§
Source§impl Clone for Annotation
impl Clone for Annotation
Source§fn clone(&self) -> Annotation
fn clone(&self) -> Annotation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more