Trait Table

Source
pub trait Table: Sized + 'static {
    type Schema;
    type Dummy<'t>;
    type Referer;

    // 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§

Source

type Schema

The schema that this table is a part of.

Source

type Dummy<'t>

The type returned by the Table::dummy method.

Source

type Referer

The type of error when a delete fails due to a foreign key constraint.

Required Methods§

Source

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:

Provided Methods§

Source

fn join<'inner>( rows: &mut Rows<'inner, Self::Schema>, ) -> Column<'inner, Self::Schema, Self>

Please refer to Rows::join.

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§