Trait atmosphere::Table
source · pub trait Table: Sized + Send + for<'r> FromRow<'r, <Postgres as Database>::Row> + 'static {
type PrimaryKey: Sync + Sized + 'static + for<'q> Encode<'q, Postgres> + Type<Postgres> + Send;
const SCHEMA: &'static str;
const TABLE: &'static str;
const PRIMARY_KEY: PrimaryKey<Self>;
const FOREIGN_KEYS: &'static [ForeignKey<Self>];
const DATA_COLUMNS: &'static [DataColumn<Self>];
const TIMESTAMP_COLUMNS: &'static [TimestampColumn<Self>];
// Required method
fn pk(&self) -> &Self::PrimaryKey;
}Expand description
SQL Table Definition
Represents the definition of a SQL table within the framework, encompassing primary keys, foreign keys, data columns, and timestamp columns. This trait should be implemented by structs that represent database tables, providing metadata and utility functions for table manipulation and query building.
Required Associated Types§
sourcetype PrimaryKey: Sync + Sized + 'static + for<'q> Encode<'q, Postgres> + Type<Postgres> + Send
type PrimaryKey: Sync + Sized + 'static + for<'q> Encode<'q, Postgres> + Type<Postgres> + Send
The type of the primary key for the table.
Required Associated Constants§
sourceconst PRIMARY_KEY: PrimaryKey<Self>
const PRIMARY_KEY: PrimaryKey<Self>
The primary key column of the table.
sourceconst FOREIGN_KEYS: &'static [ForeignKey<Self>]
const FOREIGN_KEYS: &'static [ForeignKey<Self>]
An array of foreign key columns.
sourceconst DATA_COLUMNS: &'static [DataColumn<Self>]
const DATA_COLUMNS: &'static [DataColumn<Self>]
An array of data columns.
sourceconst TIMESTAMP_COLUMNS: &'static [TimestampColumn<Self>]
const TIMESTAMP_COLUMNS: &'static [TimestampColumn<Self>]
An array of timestamp columns.
Required Methods§
sourcefn pk(&self) -> &Self::PrimaryKey
fn pk(&self) -> &Self::PrimaryKey
Returns a reference to the primary key of the table instance.
Object Safety§
This trait is not object safe.