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§
Sourceconst NAME: &'static str
const NAME: &'static str
Name of the table: #[derive(Table)] uses the lowercase name of the struct
Sourceconst DEFINITION: TableDef
const DEFINITION: TableDef
The TableDef struct defines the table and is used to assemble the CREATE_TABLE SQL statement
Sourceconst CREATE_TABLE: &'static str
const CREATE_TABLE: &'static str
CREATE TABLE SQL statement
Sourceconst ALL_COLUMNS: &'static [&'static str]
const ALL_COLUMNS: &'static [&'static str]
Names of all the Columns that make up the table.
Sourceconst KEY_COLUMNS: &'static [&'static str]
const KEY_COLUMNS: &'static [&'static str]
Sourceconst OTHER_COLUMNS: &'static [&'static str]
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§
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.