pub trait TableSchemawhere
Self: Encode + CandidType + 'static,{
type Record: TableRecord<Schema = Self>;
type Insert: InsertRecord<Schema = Self>;
type Update: UpdateRecord<Schema = Self>;
type ForeignFetcher: ForeignFetcher;
// Required methods
fn table_name() -> &'static str;
fn columns() -> &'static [ColumnDef];
fn primary_key() -> &'static str;
fn to_values(self) -> Vec<(ColumnDef, Value)>;
// Provided methods
fn foreign_fetcher() -> Self::ForeignFetcher { ... }
fn fingerprint() -> TableFingerprint { ... }
}Expand description
Table schema representation.
It is used to define the structure of a database table.
Required Associated Types§
Sourcetype Record: TableRecord<Schema = Self>
type Record: TableRecord<Schema = Self>
The TableRecord type associated with this table schema;
which is the data returned by a query.
Sourcetype Insert: InsertRecord<Schema = Self>
type Insert: InsertRecord<Schema = Self>
The InsertRecord type associated with this table schema.
Sourcetype Update: UpdateRecord<Schema = Self>
type Update: UpdateRecord<Schema = Self>
The UpdateRecord type associated with this table schema.
Sourcetype ForeignFetcher: ForeignFetcher
type ForeignFetcher: ForeignFetcher
The ForeignFetcher type associated with this table schema.
Required Methods§
Sourcefn table_name() -> &'static str
fn table_name() -> &'static str
Returns the name of the table.
Sourcefn primary_key() -> &'static str
fn primary_key() -> &'static str
Returns the name of the primary key column.
Provided Methods§
Sourcefn foreign_fetcher() -> Self::ForeignFetcher
fn foreign_fetcher() -> Self::ForeignFetcher
Returns an instance of the ForeignFetcher for this table schema.
Sourcefn fingerprint() -> TableFingerprint
fn fingerprint() -> TableFingerprint
Returns the fingerprint of the table schema.
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.