TableSchema

Trait TableSchema 

Source
pub trait TableSchema
where 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§

Source

type Record: TableRecord<Schema = Self>

The TableRecord type associated with this table schema; which is the data returned by a query.

Source

type Insert: InsertRecord<Schema = Self>

The InsertRecord type associated with this table schema.

Source

type Update: UpdateRecord<Schema = Self>

The UpdateRecord type associated with this table schema.

Source

type ForeignFetcher: ForeignFetcher

The ForeignFetcher type associated with this table schema.

Required Methods§

Source

fn table_name() -> &'static str

Returns the name of the table.

Source

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

Returns the column definitions of the table.

Source

fn primary_key() -> &'static str

Returns the name of the primary key column.

Source

fn to_values(self) -> Vec<(ColumnDef, Value)>

Converts itself into a vector of column-value pairs.

Provided Methods§

Source

fn foreign_fetcher() -> Self::ForeignFetcher

Returns an instance of the ForeignFetcher for this table schema.

Source

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.

Implementors§