Skip to main content

Model

Trait Model 

Source
pub trait Model:
    Sized
    + Send
    + Sync
    + 'static {
    const TABLE: &'static str;

    // Required methods
    fn columns() -> &'static [ColumnDef];
    fn decode(row: &Row) -> Result<Self, DecodeError>;
    fn encode(&self) -> Vec<(&'static str, Value)>;
}
Expand description

A table owned by core or a plugin. #[derive(Model)] writes this.

Required Associated Constants§

Source

const TABLE: &'static str

Required Methods§

Source

fn columns() -> &'static [ColumnDef]

Source

fn decode(row: &Row) -> Result<Self, DecodeError>

Source

fn encode(&self) -> Vec<(&'static str, Value)>

Column values for an insert. Columns not listed get their default or NULL.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Model for Account

Source§

const TABLE: &'static str = "account"

Source§

impl Model for Session

Source§

const TABLE: &'static str = "session"

Source§

impl Model for User

Source§

const TABLE: &'static str = "user"

Source§

impl Model for Verification

Source§

const TABLE: &'static str = "verification"