docs.rs failed to build rok-fluent-0.4.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
rok-fluent-0.4.0
rok-fluent
Eloquent-inspired async ORM for Rust — PostgreSQL, MySQL, SQLite via SQLx.
[]
= { = "0.4", = ["active", "query", "postgres"] }
Features
| Flag | What it enables |
|---|---|
macros (default) |
#[derive(Model, Table, Resource, Seed)], query! macro |
active |
Active Record — ModelQuery, PgModel, CrudService, scopes, eager loading |
query |
Typed DSL — db::select().from(table).where_(…), JOINs, CTEs, aggregates, window functions |
postgres / sqlite / mysql |
Database backend |
axum |
OrmLayer middleware (implies postgres) |
tracing / metrics |
OpenTelemetry spans / Prometheus counters |
tenant |
Multi-tenancy via Tower layer |
replica |
Read-replica routing strategies |
factory / factory-postgres |
Test factories with Faker data generator |
migrate / migrate-postgres / migrate-sqlite / migrate-mysql |
Schema migration runner |
cli |
rok db CLI — migrate, rollback, status, schema dump, schema diff |
full |
Everything above |
Quick Start
Typed DSL (query feature)
use db;
// SELECT … FROM users WHERE email LIKE $1 ORDER BY name ASC LIMIT 25
let users: = select
.from
.where_
.order_by
.limit
.fetch_all.await?;
// INSERT … RETURNING *
let user: User = insert_into
.values
.returning
.fetch_one.await?;
// Upsert — INSERT … ON CONFLICT DO UPDATE
let user: User = insert_into
.values_typed
.on_conflict.do_update
.returning
.fetch_one.await?;
// Join with typed ON clause
let rows: = select
.from
.inner_join
.fetch_all.await?;
// Pagination
let page: = select
.from
.paginate.await?;
// Window functions — rank, row_number, lag, lead
use ;
let ranked: = select
.from
.win_col
.fetch_all.await?;
Active Record (active + postgres features)
use Model;
// Fluent query
let users = query
.where_eq
.order_by_desc
.limit
.all.await?;
// Find by primary key
let user = find.await?;
// Paginate
let page: = query
.where_eq
.paginate.await?;
Transactions & Locking
use ;
// Transaction with savepoints
let tx = begin.await?;
let result = tx.create.await?;
tx.commit.await?;
// Advisory lock
acquire.await?;
// ... critical section ...
release.await?;
Service Layer (active + postgres)
use ;
let crud = new;
// CRUD
let user = crud.find.await?;
let page = crud.paginate.await?;
let created = crud.create.await?;
let updated = crud.update.await?;
crud.delete.await?;
// Filtering & sorting
let results = crud.query
.apply
.apply
.paginate.await?;
// Batch operations
let batch = new;
let ids = batch.bulk_insert.await?;
batch.bulk_upsert_by.await?;
Migration from rok-orm 0.3
# Before (5 crates)
= { = "0.3", = ["postgres", "macros"] }
= { = "0.3" }
= { = "0.3" }
= { = "0.3", = ["postgres"] }
= { = "0.3", = ["postgres"] }
# After (1 crate)
= { = "0.4", = ["postgres", "macros", "migrate-postgres", "factory-postgres"] }
Import path changes:
rok_orm::→rok_fluent::rok_orm_core::SqlValue→rok_fluent::SqlValuerok_orm_migrate::MigrationRunner→rok_fluent::migrate::MigrationRunner#[derive(rok_orm_macros::Model)]→#[derive(rok_fluent::Model)]
Resources
License
MIT