Skip to main content

Module relations

Module relations 

Source
Expand description

Relation field types.

  • ForeignKey<T>: a column holding T’s primary key, plus an optional cached T filled by select_related / prefetch_related or 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§

ForeignKey
A many-to-one reference to T stored as T’s primary key.
ManyToManyManager
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 on db.

Type Aliases§

OneToOne
A one-to-one reference: a unique ForeignKey.