Skip to main content

Crate sova_db

Crate sova_db 

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

DatabaseConnection
A handle to a database — implements ConnectionTrait and TransactionTrait so it works with every query and mutation method in SeaORM.
Db
SeaORM pool plugin (backend selected by URL + Cargo features).
DbError
Newtype around SeaORM DbErr mapped to HTTP via Error::Response.
DbPool
Shared pool handle filled during on_startup.
Page
One page of results + meta.
PageParams
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.
MigrateCmd

Traits§

ActiveModelTrait
The editable counterpart of a Model, used to build INSERT and UPDATE statements.
ColumnTrait
Operations and comparisons available on every entity column.
ConnectionTrait
A connection (or transaction) that can run queries against the database.
DbExt
Convenient access to the request DbHandle.
EntityTrait
The contract every SeaORM entity implements — a static description of a table plus the CRUD entry points used to query it.
IntoActiveModel
A Trait for any type that can be converted into an ActiveModel, can be derived using DeriveIntoActiveModel.
MigrationTrait
The migration definition
MigratorTrait
Performing migrations on a database
PageExt
req.page_params().
PaginateExt
Paginate a SeaORM Select.
PaginatorTrait
Extension trait that adds .paginate(db, page_size) to anything page-able — Select, SelectTwo, Selector, SelectorRaw.
QueryFilter
Methods for adding WHERE / AND / OR conditions to a query. The entry point most code uses is filter.
QueryOrder
Methods for adding ORDER BY clauses to a query.
QuerySelect
Methods for narrowing a query’s projection, joining other tables, and adding GROUP BY / HAVING clauses. Implemented for Select, SelectTwo, SelectTwoMany, and the higher-arity selects.
TransactionTrait
Begin a database transaction.

Functions§

parse_migrate_args
Parse argv after the migrate command name.
test_db
Connect via DATABASE_URL and begin a transaction for test isolation.
transaction
Open a request-scoped transaction; commit on 2xx, otherwise rollback.