Expand description
SeaORM database plugin for Sova (postgres / sqlite / mysql via Cargo features).
ⓘ
app.install(Db::from_env().migrations::<Migrator>());
let u = User::find_by_id(id).one(req.db()).await?;Re-exports§
pub use sea_orm::Set;
Structs§
- Database
Connection - A handle to a database — implements
ConnectionTraitandTransactionTraitso it works with every query and mutation method in SeaORM. - Db
- SeaORM pool plugin (backend selected by URL + Cargo features).
- DbError
- Newtype around SeaORM
DbErrmapped to HTTP viaError::Response. - DbPool
- Shared pool handle filled during
on_startup. - Page
- One page of results + meta.
- Page
Params - 1-based page + page size from query (
?page=&per_page=). - TestDb
- Isolated test connection: pool + open transaction that rolls back on
TestDb::rollback.
Enums§
- DbHandle
- Request-scoped DB handle: pool connection or open transaction.
- Migrate
Cmd
Traits§
- Active
Model Trait - The editable counterpart of a
Model, used to buildINSERTandUPDATEstatements. - Column
Trait - Operations and comparisons available on every entity column.
- Connection
Trait - A connection (or transaction) that can run queries against the database.
- DbExt
- Convenient access to the request
DbHandle. - Entity
Trait - The contract every SeaORM entity implements — a static description of a table plus the CRUD entry points used to query it.
- Into
Active Model - A Trait for any type that can be converted into an
ActiveModel, can be derived usingDeriveIntoActiveModel. - Migration
Trait - The migration definition
- Migrator
Trait - Performing migrations on a database
- PageExt
req.page_params().- Paginate
Ext - Paginate a SeaORM
Select. - Paginator
Trait - Extension trait that adds
.paginate(db, page_size)to anything page-able —Select,SelectTwo,Selector,SelectorRaw. - Query
Filter - Methods for adding
WHERE/AND/ORconditions to a query. The entry point most code uses isfilter. - Query
Order - Methods for adding
ORDER BYclauses to a query. - Query
Select - Methods for narrowing a query’s projection, joining other tables, and
adding
GROUP BY/HAVINGclauses. Implemented forSelect,SelectTwo,SelectTwoMany, and the higher-arity selects. - Transaction
Trait - Begin a database transaction.
Functions§
- parse_
migrate_ args - Parse argv after the
migratecommand name. - test_db
- Connect via
DATABASE_URLand begin a transaction for test isolation. - transaction
- Open a request-scoped transaction; commit on 2xx, otherwise rollback.