Expand description
Cast — Eloquent-shaped ORM for Anvil. Facade crate.
ⓘ
use cast::{Model, Pool};
#[derive(cast::Model)]
#[table("users")]
pub struct User {
pub id: i64,
pub name: String,
pub email: String,
}
let users = User::query()
.where_eq(User::columns().email(), "x@y.com".to_string())
.get(&pool).await?;Re-exports§
Modules§
- chrono
- Chrono: Date and Time for Rust
- column
- Typed column references. Generated by
#[derive(Model)]. - error
- Cast-specific errors. Converted to
anvil::Errorat the HTTP layer. - migration
- Migration runner. Each migration is a Rust value with
up/downmethods. - model
- The
Modeltrait — every Cast model implements this. - pool
- Database connection pool. Postgres-only for v1 POC.
- query
- Query builder. Typed where clauses on top of sea-query + sqlx.
- relation
- Relationship definitions.
RelationDefis implemented by zero-sized types generated by#[has_many]/#[belongs_to]attribute parsing. - schema
- Schema builder. Used in migrations:
Schema::create("users", |t| ...). - sea_
query - sqlx
- The async SQL toolkit for Rust, built with ❤️ by the LaunchBadge team.
Structs§
- Belongs
To - Column
- Column
Def - Column
Ref - Untyped column reference for the query builder’s internal use.
- HasMany
- HasOne
- Loaded
- Wrapper for eager-loaded query results. Generic over the loading shape;
in practice a concrete
LoadedUserWithPoststype is generated per derive. - Migration
Runner - Query
Builder - Schema
- Table
- A table definition assembled inside
Schema::create’s closure.
Enums§
Traits§
Functions§
Type Aliases§
Derive Macros§