Skip to main content

DataObject

Trait DataObject 

Source
pub trait DataObject:
    DataResult<DBO = Self>
    + DataObjectInternal
    + Sync {
    type PKType: PrimaryKeyType;
    type Fields: Default;

    const PKCOL: &'static str;
    const TABLE: &'static str;
    const AUTO_PK: bool;

    // Required method
    fn pk(&self) -> &Self::PKType;
}
Expand description

An object in the database.

Rather than implementing this type manually, use the #[model] attribute.

Required Associated Constants§

Source

const PKCOL: &'static str

The name of the primary key column.

Source

const TABLE: &'static str

The name of the table.

Source

const AUTO_PK: bool

Whether or not this model uses an automatic primary key set on the first save.

Required Associated Types§

Source

type PKType: PrimaryKeyType

The type of the primary key field.

Source

type Fields: Default

Link to a generated struct providing query helpers for each field.

Required Methods§

Source

fn pk(&self) -> &Self::PKType

Get the primary key

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§