pub struct TableMap { /* private fields */ }Expand description
How an entity lands on a table.
Implementations§
Source§impl TableMap
impl TableMap
Sourcepub fn new(table: impl Into<String>) -> Self
pub fn new(table: impl Into<String>) -> Self
On this table, with each field in a column of its name.
Sourcepub fn column(self, field: impl Into<String>, column: impl Into<String>) -> Self
pub fn column(self, field: impl Into<String>, column: impl Into<String>) -> Self
This field is in a column of another name.
Sourcepub fn computed(self, field: impl Into<String>, sql: impl Into<String>) -> Self
pub fn computed(self, field: impl Into<String>, sql: impl Into<String>) -> Self
This field is not stored: the database works it out with this SQL expression over the table, which is trusted as written and never comes from people.
Sourcepub fn before_save(self, hook: impl Fn(&mut Object) + 'static) -> Self
pub fn before_save(self, hook: impl Fn(&mut Object) + 'static) -> Self
Runs on a record just before it is written, to fit what the table asks for.
Sourcepub fn after_load(self, hook: impl Fn(&mut Object) + 'static) -> Self
pub fn after_load(self, hook: impl Fn(&mut Object) + 'static) -> Self
Runs on a record just after it is read.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TableMap
impl !Send for TableMap
impl !Sync for TableMap
impl !UnwindSafe for TableMap
impl Freeze for TableMap
impl Unpin for TableMap
impl UnsafeUnpin for TableMap
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