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

The type of the primary key field.

Associated Constants

The name of the primary key column.

The name of the table.

Required methods

Get the primary key

Save the object to the database.

Delete the object from the database.

Provided methods

Find this object in the database based on primary key.

Implementors