pub trait BelongsTo<Parent> {
    type ForeignKey: Hash + Eq;
    type ForeignKeyColumn: Column;
    fn foreign_key(&self) -> Option<&Self::ForeignKey>;
    fn foreign_key_column() -> Self::ForeignKeyColumn;
}
Expand description

Indicates that a type belongs to Parent

Specifically, this means that this struct has fields which correspond to the primary key of Parent. This implies that a foreign key relationship exists on the tables.

This trait is not capable of supporting composite foreign keys

Associated Types

The foreign key of this struct

The database column representing the foreign key of the table this struct represents

Required methods

Returns the foreign key for self

Returns the foreign key column of this struct’s table

Implementations on Foreign Types

Implementors