Skip to main content

Module model

Module model 

Source
Expand description

Model traits for Ferro ORM

Provides Laravel-like active record pattern over SeaORM entities.

§Scoped Queries

Use the ScopedQuery trait to define reusable query scopes:

impl ScopedQuery for animals::Entity {
    type Scope = AnimalScope;
}

enum AnimalScope {
    ForShelter(i64),
    Available,
    Species(String),
}

// Usage:
let animals = Animal::scoped(AnimalScope::ForShelter(shelter_id))
    .and(AnimalScope::Available)
    .all()
    .await?;

Macros§

define_scopes
Macro to define scopes for an entity

Structs§

ScopedQueryBuilder
Query builder with scopes applied

Traits§

Model
Trait providing Laravel-like read operations on SeaORM entities
ModelMut
Trait providing Laravel-like write operations on SeaORM entities
Scope
A scope that can be applied to a query
ScopedQuery
Trait for defining reusable query scopes on entities