Trait diesel::query_source::Table
source · pub trait Table:
QuerySource
+ AsQuery
+ Sized {
type PrimaryKey: SelectableExpression<Self> + ValidGrouping<()>;
type AllColumns: SelectableExpression<Self> + ValidGrouping<()>;
// Required methods
fn primary_key(&self) -> Self::PrimaryKey;
fn all_columns() -> Self::AllColumns;
}
Expand description
A SQL database table. Types which implement this trait should have been
generated by the table!
macro.
Required Associated Types§
sourcetype PrimaryKey: SelectableExpression<Self> + ValidGrouping<()>
type PrimaryKey: SelectableExpression<Self> + ValidGrouping<()>
The type returned by primary_key
sourcetype AllColumns: SelectableExpression<Self> + ValidGrouping<()>
type AllColumns: SelectableExpression<Self> + ValidGrouping<()>
The type returned by all_columns
Required Methods§
sourcefn primary_key(&self) -> Self::PrimaryKey
fn primary_key(&self) -> Self::PrimaryKey
Returns the primary key of this table.
If the table has a composite primary key, this will be a tuple.
sourcefn all_columns() -> Self::AllColumns
fn all_columns() -> Self::AllColumns
Returns a tuple of all columns belonging to this table.
Object Safety§
This trait is not object safe.
Implementors§
source§impl<S> Table for Only<S>where
S: Table + Clone + AsQuery,
<S as Table>::PrimaryKey: SelectableExpression<Only<S>>,
<S as Table>::AllColumns: SelectableExpression<Only<S>>,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Only<S>>,
Available on crate feature postgres_backend
only.
impl<S> Table for Only<S>where
S: Table + Clone + AsQuery,
<S as Table>::PrimaryKey: SelectableExpression<Only<S>>,
<S as Table>::AllColumns: SelectableExpression<Only<S>>,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Only<S>>,
Available on crate feature
postgres_backend
only.type PrimaryKey = <S as Table>::PrimaryKey
type AllColumns = <S as Table>::AllColumns
source§impl<S, TSM> Table for Tablesample<S, TSM>where
S: Table + Clone + AsQuery,
TSM: TablesampleMethod,
<S as Table>::PrimaryKey: SelectableExpression<Tablesample<S, TSM>>,
<S as Table>::AllColumns: SelectableExpression<Tablesample<S, TSM>>,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
Available on crate feature postgres_backend
only.
impl<S, TSM> Table for Tablesample<S, TSM>where
S: Table + Clone + AsQuery,
TSM: TablesampleMethod,
<S as Table>::PrimaryKey: SelectableExpression<Tablesample<S, TSM>>,
<S as Table>::AllColumns: SelectableExpression<Tablesample<S, TSM>>,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
Available on crate feature
postgres_backend
only.