Skip to main content

Crate cast

Crate cast 

Source
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§

pub use sea_query;
pub use sqlx;

Modules§

chrono
Chrono: Date and Time for Rust
column
Typed column references. Generated by #[derive(Model)].
error
Cast-specific errors. Converted to anvil::Error at the HTTP layer.
inventory
githubcrates-iodocs-rs
migration
Migration runner. Each migration is a Rust value with up / down methods.
model
The Model trait — every Cast model implements this.
paginator
Pagination — mirrors Laravel’s LengthAwarePaginator.
pool
Database connection pool(s).
query
Query builder. Typed where clauses on top of sea-query + sqlx.
relation
Relationship definitions. RelationDef is 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
sea_query_binder
Driver library for using SeaQuery with SQLx
sqlx
The async SQL toolkit for Rust, built with ❤️ by the LaunchBadge team.

Macros§

migration
Closure-style migration — Laravel’s Schema::create('posts', function (Blueprint $t) { ... }) ported to Rust.
scopes
Define chainable Eloquent-style local scopes on a model’s query builder.

Structs§

BelongsTo
Column
ColumnDef
ColumnRef
Untyped column reference for the query builder’s internal use.
Connection
One named connection — a write pool plus zero-or-more read replicas.
ConnectionManager
Resolves named connections — the centerpiece of Cast’s multi-database support.
HasMany
HasOne
Loaded
Wrapper for eager-loaded query results. Generic over the loading shape; in practice a concrete LoadedUserWithPosts type is generated per derive.
MigrationRunner
MigrationStatus
Returned by migrate:status.
ModelRegistration
Inventory record for #[derive(Model)]. Lets boost/MCP and other introspection tools list every model registered at compile time.
Paginator
Page-aware paginator. Produced by QueryBuilder::paginate(per_page, page, pool).
QueryBuilder
Schema
Table
A table definition assembled inside the build closure.

Enums§

Driver
Which database engine a connection is talking to.
Error
Pool
Driver-tagged pool. Variant tells you which backing sqlx type is live.

Traits§

Migration
Model
RelationDef
RelationKind

Functions§

connect
Connect to a database, dispatching by URL scheme.
registered_models

Type Aliases§

Result

Derive Macros§

Model