Trait butane_core::DataObject [−][src]
pub trait DataObject: DataResult<DBO = Self> { type PKType: PrimaryKeyType; type Fields: Default; const PKCOL: &'static str; const TABLE: &'static str; fn pk(&self) -> &Self::PKType; fn save(&mut self, conn: &impl ConnectionMethods) -> Result<()>; fn delete(&self, conn: &impl ConnectionMethods) -> Result<()>; fn get(
conn: &impl ConnectionMethods,
id: impl Borrow<Self::PKType>
) -> Result<Self>
where
Self: Sized, { ... } }
Expand description
An object in the database.
Rather than implementing this type manually, use the
#[model]
attribute.
Associated Types
Associated Constants
Required methods
fn save(&mut self, conn: &impl ConnectionMethods) -> Result<()>
fn save(&mut self, conn: &impl ConnectionMethods) -> Result<()>
Save the object to the database.
fn delete(&self, conn: &impl ConnectionMethods) -> Result<()>
fn delete(&self, conn: &impl ConnectionMethods) -> Result<()>
Delete the object from the database.