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>,
pub generated_id: Option<IdGeneration>,
}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>§generated_id: Option<IdGeneration>Implementations§
Source§impl DbField
impl DbField
Sourcepub fn new(name: impl Into<String>, field_type: DbFieldType) -> DbField
pub fn new(name: impl Into<String>, field_type: DbFieldType) -> DbField
Create a required, returned, input-accepted field.
pub fn optional(self) -> DbField
pub fn unique(self) -> DbField
pub fn indexed(self) -> DbField
pub fn generated(self) -> DbField
pub fn generated_id(self, generation: IdGeneration) -> DbField
pub fn references(self, foreign_key: ForeignKey) -> DbField
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DbField
impl<'de> Deserialize<'de> for DbField
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DbField, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DbField, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DbField
Source§impl Serialize for DbField
impl Serialize for DbField
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.