Expand description
Relation field types.
ForeignKey<T>: a column holdingT’s primary key, plus an optional cachedTfilled byselect_related/prefetch_relatedor a previous fetch.Option<ForeignKey<T>>is a nullable FK.OneToOne<T>: the same storage; the derive marks the column unique.- Many-to-many relations are declared on the model
(
#[model(many_to_many(tags(Tag)))]), not as struct fields, because they have no column and no serialized form.
Structs§
- Foreign
Key - A many-to-one reference to
Tstored asT’s primary key. - Many
ToMany Manager - Accessor for one many-to-many relation of one source object
(
post.tags(&db)). Generated accessors construct it; its query and mutation methods (all,add,remove,clear,set) run ondb.
Type Aliases§
- OneTo
One - A one-to-one reference: a unique
ForeignKey.