pub struct ModelMeta {
pub model: &'static str,
pub table: &'static str,
pub fields: &'static [&'static str],
pub columns: &'static [&'static str],
}Expand description
Metadata about a Model implementor.
Can be retrieved via the Model::metadata and Model::metadata_dyn methods.
Fields§
§model: &'static strThe name of the model type.
Example
#[derive(Model)]
#[table("foos")]
pub struct Foo {
pub field: String
}
assert_eq!("Foo", Foo::metadata().model)table: &'static strThe name of the model table.
Example
#[derive(Model)]
#[table("foos")]
pub struct Foo {
pub field: String
}
assert_eq!("foos", Foo::metadata().table)fields: &'static [&'static str]The field names of the model type, in order of their definition.
Example
#[derive(Model)]
#[table("foos")]
pub struct Foo {
pub bar: String,
pub qux: String,
}
assert_eq!(&["bar", "qux"], Foo::metadata().fields)columns: &'static [&'static str]The columns of the model table.
Example
#[derive(Model)]
#[table("foos")]
pub struct Foo {
pub bar: String,
#[column("baz")]
pub qux: String,
}
assert_eq!(&["bar", "baz"], Foo::metadata().columns)Trait Implementations§
source§impl PartialEq for ModelMeta
impl PartialEq for ModelMeta
impl Eq for ModelMeta
impl StructuralEq for ModelMeta
impl StructuralPartialEq for ModelMeta
Auto Trait Implementations§
impl RefUnwindSafe for ModelMeta
impl Send for ModelMeta
impl Sync for ModelMeta
impl Unpin for ModelMeta
impl UnwindSafe for ModelMeta
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more