Expand description
Core types for rustango.
This crate is dependency-light on purpose: no async, no DB drivers, no proc-macros. Anything that needs to be referenced by both the macro output and the runtime lives here.
Structs§
- Admin
Config - Django ModelAdmin-shape per-model admin customization. Populated by
the
Modelderive when the struct carries#[rustango(admin(...))]. - Aggregate
Query - A
SELECT … GROUP BY … HAVING …query. Returned rows are untyped (HashMap<String, SqlValue>) because the projection is dynamic. - Assignment
- One
column = valuepair in anUPDATE ... SET ...clause. - Bulk
Insert Query - Compiled multi-row
INSERT— one round-trip for N rows. - Bulk
Update Query - Bulk per-row UPDATE using
UPDATE t SET … FROM (VALUES …). One row in the VALUES clause per input item; the PK identifies which table row to update. - Check
Constraint - Descriptor for one table-level CHECK constraint.
- Composite
FkRelation - Multi-column (“composite”) foreign key relation, declared at the
model level rather than the field level — single-column FKs stay
in
FieldSchema::relation, composite FKs live here so each participating column keeps its plain Rust type. - Count
Query - Compiled
SELECT COUNT(*)— same shape as aDeleteQuery(model + where clause); the writer emitsCOUNT(*)projection and noLIMIT/OFFSET. - Delete
Query - Compiled
DELETE. - Field
Schema - Static description of a single column on a model.
- Fieldset
- One group of fields on a create/edit form (slice 10.5).
- Filter
- One predicate in a
WHEREclause:column <op> value. Always the leaf of aWhereExprtree. - Generic
Relation - Generic (“any model”) foreign key declared at the model level —
pairs a
content_type_idcolumn with anobject_pkcolumn whose values together identify a row in any registered model. The pointed-at model varies per row. - Index
Schema - Descriptor for one
CREATE INDEXemitted by the migration writer. - Insert
Query returningnames columns the writer should append afterRETURNING— used forAuto<T>PKs, where the row is inserted with the column omitted so Postgres’ sequence DEFAULT fires, and the assigned value is then read back into the model.- Join
- A
LEFT JOINagainst a target model. - M2MRelation
- Descriptor for one many-to-many relation declared via
#[rustango(m2m(name = "tags", to = "app_tags", through = "post_tags", src = "post_id", dst = "tag_id"))]. - Model
Schema - Static description of a model.
- Order
Clause - Single column in an
ORDER BYclause. Slice 9.0b. - Search
Clause (col1 ILIKE %q% OR col2 ILIKE %q% …)— single-parameter case-insensitive substring match across multiple columns. Used by the admin’s?q=…box.- Select
Query - Compiled
SELECTover a single model with an optional WHERE clause expressed as aWhereExprtree. - Typed
Assignment - An
Assignmenttagged with the model it applies to. - Typed
Expr - Typed boolean expression — a
TypedFiltertree composed with.and()/.or(). Constructed implicitly from anyTypedFilterviaInto, so callers usually never name this type: - Typed
Filter - A
Filtertagged with the model it applies to. - Update
Query - Compiled
UPDATE.
Enums§
- Aggregate
Expr - One aggregate expression in an
AggregateQuery. - Conflict
Clause - Compiled
INSERTof a single row. - Field
Type - Kind of value stored in a column.
- Model
Scope - Where a model’s table lives in a tenancy deployment. Mirrors
crate::migrate::MigrationScopebut on the model side, so the migration generator can route changes to the right scoped file without touching the runtime schema-discovery path. - Op
- Comparison operator on a single column.
- Query
Error - Error raised while building or compiling a
QuerySet. - Relation
- Static description of a relation to another model.
- SqlValue
- A typed value that can be bound to a query parameter.
- Where
Expr - Boolean expression in a
WHEREclause — leafFilters composed withAND/ORto arbitrary depth.
Traits§
- Column
- A typed reference to a single scalar column on
Self::Model. - Model
- Trait every
#[derive(Model)]struct implements.
Functions§
- infer_
app_ label_ from_ module_ path - Parse the Rust module path produced by
module_path!()and return the first segment after the crate root, orNonewhen the model lives at the project root. Public so callers (admin, makemigrations CLI, the diagnosticmanage list-appsverb) can apply the same inference rules to module-path strings they already have. - validate_
value - Validate a single bound value against its field’s declared bounds.
- version
- Returns the crate version. Used by the workspace smoke test.