Table

Trait Table 

Source
pub trait Table {
    type References;

    const NAME: &'static str;
    const DEFINITION: TableDef;
    const CREATE_TABLE: &'static str;
    const ALL_COLUMNS: &'static [&'static str];
    const KEY_COLUMNS: &'static [&'static str];
    const OTHER_COLUMNS: &'static [&'static str];
}
Expand description

SQL table that can be used in a database

The items that make up this trait are mostly an implementation detail. See the Entry trait (which is also implemented by the #[derive(Table)] proc-macro) as well as the HasKey trait (same, but only if the table has a primary key) for SQL generated to be used by you.

Required Associated Constants§

Source

const NAME: &'static str

Name of the table: #[derive(Table)] uses the lowercase name of the struct

Source

const DEFINITION: TableDef

The TableDef struct defines the table and is used to assemble the CREATE_TABLE SQL statement

Source

const CREATE_TABLE: &'static str

CREATE TABLE SQL statement

Source

const ALL_COLUMNS: &'static [&'static str]

Names of all the Columns that make up the table.

Source

const KEY_COLUMNS: &'static [&'static str]

Names of the Columns that make up the values of the primary #[key]

This is empty if the Table has no primary key.

Source

const OTHER_COLUMNS: &'static [&'static str]

Names of all the Columns that make up the table, which aren’t part of the primary key.

Required Associated Types§

Source

type References

Nested tuple that contains all the types (i.e. other tables) referenced (e.g. via Ref) by Values in this table.

See the meta module for a little more detail on how this is used for Schema validation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§