Expand description
Fluent query builder for Eloquent-like API
Provides a chainable query interface that uses the global DB connection.
§Example
ⓘ
use ferro_rs::models::todos::{Todo, Column};
// Simple query
let todos = Todo::query().all().await?;
// With filters
let todo = Todo::query()
.filter(Column::Title.eq("test"))
.filter(Column::Id.gt(5))
.first()
.await?;
// With ordering and pagination
let todos = Todo::query()
.order_by_desc(Column::CreatedAt)
.limit(10)
.offset(20)
.all()
.await?;
// With eager loading (avoids N+1)
let (animals, shelters) = Animal::query()
.all_with(|animals| async {
Shelter::batch_load(animals.iter().map(|a| a.shelter_id)).await
})
.await?;Structs§
- Query
Builder - Fluent query builder wrapper