pub trait Table: Sized + 'static {
type Ext<T>: RefCast<From = T>;
type Schema;
type Dummy<'t>;
// Required method
fn dummy<'t>(
val: impl IntoColumn<'t, Self::Schema, Typ = Self>,
) -> Self::Dummy<'t>;
// Provided method
fn join<'inner>(
rows: &mut Rows<'inner, Self::Schema>,
) -> Column<'inner, Self::Schema, Self> { ... }
}Expand description
This trait is implemented for all table types as generated by the crate::migration::schema macro.
You can not implement this trait yourself!
Required Associated Types§
Sourcetype Ext<T>: RefCast<From = T>
type Ext<T>: RefCast<From = T>
The associated type Table::Ext is used as the deref target by several types that implement IntoColumn. This adds convenient methods to access related tables that have a foreign key constraint.
Sourcetype Dummy<'t>
type Dummy<'t>
The type returned by the Table::dummy method.
Required Methods§
Sourcefn dummy<'t>(
val: impl IntoColumn<'t, Self::Schema, Typ = Self>,
) -> Self::Dummy<'t>
fn dummy<'t>( val: impl IntoColumn<'t, Self::Schema, Typ = Self>, ) -> Self::Dummy<'t>
Create a dummy that can be used for TransactionMut::try_insert and TransactionMut::try_update etc.
txn.find_and_update(User {
email: new_email,
..user.dummy()
})
.unwrap();Note that all fields of the dummy have type Column, so if you want to change the value to something that is not a Column, then you need to do one of the following:
- Turn the value into a Column with IntoColumn::into_column.
- Use
#![feature(type_changing_struct_update)].
Provided Methods§
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.