pub struct DbField {
pub name: String,
pub field_type: DbFieldType,
pub required: bool,
pub unique: bool,
pub index: bool,
pub returned: bool,
pub input: bool,
pub foreign_key: Option<ForeignKey>,
}Expand description
Field metadata used by adapters and migrations.
Fields§
§name: String§field_type: DbFieldType§required: bool§unique: bool§index: bool§returned: bool§input: bool§foreign_key: Option<ForeignKey>Implementations§
Source§impl DbField
impl DbField
Sourcepub fn new(name: impl Into<String>, field_type: DbFieldType) -> Self
pub fn new(name: impl Into<String>, field_type: DbFieldType) -> Self
Create a required, returned, input-accepted field.
pub fn optional(self) -> Self
pub fn unique(self) -> Self
pub fn indexed(self) -> Self
pub fn generated(self) -> Self
pub fn references(self, foreign_key: ForeignKey) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DbField
impl<'de> Deserialize<'de> for DbField
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
impl Eq for DbField
impl StructuralPartialEq for DbField
Auto Trait Implementations§
impl Freeze for DbField
impl RefUnwindSafe for DbField
impl Send for DbField
impl Sync for DbField
impl Unpin for DbField
impl UnsafeUnpin for DbField
impl UnwindSafe for DbField
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.