Skip to main content

Module column

Module column 

Source
Expand description

Column and ordering types for Rango ORM.

Structs§

Column
A typed column reference: M is the model, T the field type.
ManyToManyField
A ManyToMany<R> field on M: #[derive(Model)] generates Article::TAGS for a tags: ManyToMany<Tag> field. Not a column, so it only works with prefetch_related.
Ordering
An ordering for a column.

Enums§

PrefetchKind
How prefetch_related finds the R rows of each M.

Traits§

ColumnRef
A column reference accepted by query builder methods: either a typed Column<M, T> generated by #[derive(Model)] (checked at compile time) or a &str (checked by the database at runtime).
FilterColumn
A column accepted by comparison filters (eq, gt, …) together with its value type V.
FilterValue
A value that can be compared to a column of field type T: the field type itself, or its plain Rust equivalent (i32 for FieldInt, &str for FieldEmail, …). Filter values are not validated like field constructors are: "not-an-email" is a valid value to search for.
ForeignKeyRef
A foreign key column on M pointing to T: Post::AUTHOR_ID (an author_id: ForeignKey<User> field) is a ForeignKeyRef<Post, User>, so relation methods infer the related model and reject a column that points elsewhere. &str is accepted too (then name the model with ::<T>).
OrderRef
Accepted by order_by: Column<M, T> (ascending), Ordering<M> (from .asc() / .desc()), or &str where a leading - means descending (Django style).
PrefetchRef
Accepted by prefetch_related: a reverse foreign key (Comment::POST_ID, a post_id: ForeignKey<Post> field on Comment), a M2M field (Article::TAGS), or &str naming the reverse FK column (then name the model with ::<R>).