Trait butane::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<(), Error>;
fn delete(&self, conn: &impl ConnectionMethods) -> Result<(), Error>;
fn get(
conn: &impl ConnectionMethods,
id: impl Borrow<Self::PKType>
) -> Result<Self, Error> { ... }
}
Expand description
An object in the database.
Rather than implementing this type manually, use the
#[model]
attribute.
Associated Types
Associated Constants
Required methods
Save the object to the database.