Expand description
Core runtime for the Tork ORM.
This crate holds the backend-neutral pieces of the ORM: the Value type that
crosses the driver boundary, the owned Row returned from queries, the
dialect abstraction that makes SQL generation backend-specific, the database
drivers, and the Database handle and Executor trait used to run SQL.
End users do not depend on this crate directly; they depend on tork-orm, which
re-exports this runtime together with the derive macros.
Re-exports§
pub use dialect::SqlType;pub use registry::registered_models;pub use registry::ModelSchemaEntry;pub use registry::TableSchema;pub use preload::Preloaded;pub use preload::Preloader;pub use query::ast::Cte;pub use query::ast::CteQuery;pub use query::ast::Join;pub use query::ast::JoinKind;pub use query::ast::LockClause;pub use query::ast::LockStrength;pub use query::ast::LockWait;pub use query::ast::OrderTerm;pub use query::ast::SelectItem;pub use query::ast::SelectStatement;pub use query::ast::UnionStatement;pub use query::ast::WithClause;pub use query::UnionQuery;pub use query::column::Column;pub use query::column::IntoAssignExpr;pub use query::column::IntoSqlValue;pub use query::column::Numeric;pub use query::expr::AggFunc;pub use query::expr::BinaryOp;pub use query::expr::CaseWhen;pub use query::expr::Expr;pub use query::expr::ExprOver;pub use query::expr::LogicalOp;pub use query::expr::Window;pub use query::expr::WindowBound;pub use query::expr::WindowFrame;pub use query::expr::WindowFrameUnit;pub use query::func::abs;pub use query::func::ceil;pub use query::func::coalesce;pub use query::func::concat;pub use query::func::cume_dist;pub use query::func::current_date;pub use query::func::current_time;pub use query::func::current_timestamp;pub use query::func::dense_rank;pub use query::func::first_value;pub use query::func::floor;pub use query::func::func;pub use query::func::greatest;pub use query::func::lag;pub use query::func::lag_default;pub use query::func::lag_offset;pub use query::func::last_value;pub use query::func::lead;pub use query::func::lead_default;pub use query::func::lead_offset;pub use query::func::least;pub use query::func::length;pub use query::func::lower;pub use query::func::ntile;pub use query::func::nth_value;pub use query::func::nullif;pub use query::func::now;pub use query::func::percent_rank;pub use query::func::position;pub use query::func::random_value;pub use query::func::rank;pub use query::func::replace;pub use query::func::round;pub use query::func::row_number;pub use query::func::substr;pub use query::func::substr_len;pub use query::func::trim;pub use query::func::upper;pub use query::projection::ExprTuple;pub use query::projection::IntoExpr;pub use query::projection::IntoSelectItem;pub use query::projection::Projection;pub use query::write::Assignment;pub use query::write::DeleteStatement;pub use query::write::InsertStatement;pub use query::write::OnConflict;pub use query::write::UpdateStatement;pub use query::Page;pub use query::QuerySet;pub use driver::ExecuteResult;pub use serde_json;pub use uuid;
Modules§
- dialect
- The dialect abstraction: everything backend-specific about generating SQL.
- driver
- Database drivers: the bridge between the backend-neutral query layer and a concrete database engine.
- migration
- Database migrations: revision-based schema changes with up/down.
- preload
- Preloading: loading a relation’s rows without the N+1 problem.
- query
- The backend-neutral query model: typed columns, the expression and statement
AST, and the
QuerySetbuilder that assembles and runs queries. - registry
- The model registry and table-schema reflection used by
migrate generate.
Structs§
- Column
Def - The compile-time description of a single model column.
- Database
- A handle to a database.
- Foreign
KeyDef - A foreign key reference recorded on a column.
- Index
Column - One entry of an index: either a plain column or an expression, with optional ordering, null placement, collation, and operator class.
- Index
Def - The definition of an index.
- OrmError
- An error produced by the ORM.
- Relation
- Describes how a parent model
Prelates to a related modelC. - Row
- One row of a query result.
- Transaction
- An open database transaction.
- Transaction
Builder - Builds a transaction with a specific isolation level.
Enums§
- Column
Default - A database-side default value declared on a model column.
- Error
Kind - The category of an
OrmError. - Foreign
KeyAction - The action a foreign key takes when the referenced row changes.
- Isolation
Level - The locking behaviour requested when starting a transaction.
- Nulls
Order - Where
NULLs sort relative to other values in an index column. - Relation
Kind - The kind of association between two models.
- Value
- A single database value, independent of any backend.
Traits§
- Bind
Value - Converts a Rust value into a bound
Value. - DbEnum
- A Rust enum mapped to a fixed set of stored text values.
- Executor
- Something that can run SQL with bound parameters.
- FromRow
- Builds an instance from a result row.
- From
Value - Converts a
Valueread from a result row into a Rust type. - Model
- A struct that maps to a database table.
- Model
Hooks - Lifecycle hooks fired by the instance write methods.
Type Aliases§
- BoxFuture
- A boxed,
Sendfuture borrowing for'a. - Json
- A JSON column value (PostgreSQL
jsonb). An alias forserde_json::Value. - Result
- A specialized result type for ORM operations.