Expand description
The ruprizzle runtime: the crate your application depends on.
This crate provides the types that generated code compiles against: typed
Columns, Filters, Related wrappers, and the query builders that
produce CompiledSql. It also owns connection pooling (Pool),
transactions (Tx), and query execution (Executor). Migrations live in
the separate ruprizzle-migrate crate, which the CLI depends on directly —
this crate does not re-export it.
§Backends
By default ruprizzle builds on sqlx::Any, which lets the same binary talk
to PostgreSQL, MySQL/MariaDB, and SQLite. You can opt into native-driver paths:
sqlite-rusqlite— a synchronousrusqlitebackend that skips thesqlx::Anytext round-trip for SQLite. Enable it inCargo.tomland use adriver=rusqlitequery parameter on the SQLite URL.postgres-tokio-postgres— experimental nativetokio-postgresbackend behind the matching feature flag.
The public API is identical across backends. Use the typed Pool::as_any,
Pool::as_sqlite, Pool::as_postgres, and feature-gated Pool::as_rusqlite
/ Pool::as_tokio_postgres accessors when you need driver-specific behaviour.
§Prelude
Most application code can start with prelude.
Re-exports§
pub use aggregate::Aggregate;pub use aggregate::AggregateEntry;pub use aggregate::AggregateKind;pub use aggregate::AggregateScalar;pub use aggregate::AggregateSet;pub use aggregate::GroupBy;pub use aggregate::IntoAggregate;pub use aggregate::Numeric;pub use cache::InMemoryCache;pub use cache::QueryCache;pub use col::Column;pub use col::Projection;pub use error::Error;pub use executor::Executor;pub use executor::RowBatch;pub use executor::decode_rows;pub use filter::Cte;pub use filter::CteQuery;pub use filter::ExistsSubquery;pub use filter::Filter;pub use filter::FilterNode;pub use filter::JsonFilterOp;pub use filter::RawFragment;pub use filter::SpatialOp;pub use filter::Subquery;pub use filter::all;pub use filter::any;pub use hierarchy::HierarchyDirection;pub use hierarchy::HierarchyNode;pub use hierarchy::HierarchyQuery;pub use include::IncludeList;pub use include::IncludeMany;pub use include::IncludeOne;pub use include::IncludeSet;pub use join::Join2;pub use join::JoinKind;pub use join::JoinOn;pub use join::JoinSide;pub use join::LeftJoin2;pub use join::Maybe;pub use json::JsonColumn;pub use json::JsonPath;pub use json::JsonSet;pub use m2m::M2mAction;pub use m2m::M2mWrite;pub use model::Model;pub use order::OrderBy;pub use page::Page;pub use pool::HealthCheckTask;pub use pool::LoadBalancing;pub use pool::Pool;pub use pool::PoolConfig;pub use pool::PoolStats;pub use pool::ReplicaPool;pub use pool::RoutedPool;pub use pool::RoutedPoolBuilder;pub use pool::connect;pub use pool::connect_with;pub use pool::ping;pub use pool::stats;pub use query::AggregateQuery;pub use query::DeleteQuery;pub use query::GroupedQuery;pub use query::InsertManyQuery;pub use query::InsertQuery;pub use query::NestedSetter;pub use query::SelectQuery;pub use query::SetOp;pub use query::SetOpQuery;pub use query::UpdateQuery;pub use rel::DeleteAction;pub use rel::DeleteCascade;pub use rel::RelAction;pub use rel::RelWrite;pub use related::Related;pub use spatial::LineString;pub use spatial::MultiPolygon;pub use spatial::Point;pub use spatial::Polygon;pub use tx::IsolationLevel;pub use tx::Savepoint;pub use tx::Tx;pub use tx::is_retryable;pub use value::Encodable;pub use value::Ordered;pub use value::Value;pub use serde;pub use serde_json;pub use sqlx;
Modules§
- aggregate
- Typed aggregate expressions.
- cache
- Query Result Caching with TTL and Tag Invalidation.
- col
- Typed column tokens.
- error
- Runtime errors.
- executor
- The
Executorabstraction over a pool and a transaction. - filter
- Filter algebra and constructors.
- hierarchy
- Tree hierarchy queries and data structures powered by recursive CTEs.
- include
- Batched relation
includeloading. - join
- Join result types and offset-aware decoding.
- json
- JSON path and typed JSON column tokens.
- m2m
- Many-to-many relation mutations: attach, set, and detach target rows through an explicit join model.
- metrics
- Metrics facade for
ruprizzle. - model
- The
Modeltrait that generated entities implement. - order
- Order-by tokens.
- page
- Pagination results.
- pool
- Connection pool construction, replica routing, and configuration.
- prelude
- Common imports for application code.
- query
- Query builders.
- query_
manifest - Optional query-manifest recorder for offline validation.
- rel
- One-to-many relation mutations: connect, disconnect, set, and cascade.
- related
- Relation wrapper that distinguishes “not loaded” from “loaded and empty”.
- rusqlite
- Native
rusqlitebackend for the ruprizzle runtime. - spatial
- PostGIS and Geospatial Scalar Types for Ruprizzle.
- tokio_
postgres - Native
tokio-postgresbackend for the ruprizzle runtime. - tx
- Transaction handle.
- types
- Re-exported database types (chrono, uuid, decimal, json, …) so generated
code can depend on
ruprizzlealone. - value
- Owned values bound to SQL queries.
Macros§
- raw
- Builds an injection-safe raw SQL fragment.
- tokio_
postgres_ default_ row - Convenience macro for tests and examples: implement
FromTokioPostgresRowby returningDefault::default().
Structs§
- Compiled
Sql - A compiled SQL statement and its bound values.
- Counting
Executor - Wraps an executor and counts every statement that reaches it.
- Nested
Connect OrCreate - A specification for nested
connect_or_createoperations. - Nested
Create - A builder for creating a nested child entity.
- Nested
RelWrite - A nested write specification on model
Mtargeting child relationC. - Offset
Row - A view into a concrete
sqlxrow where column0is the column atoffsetof the original row. - Plan
Cache - A thread-safe key → SQL string map.
Enums§
- RelNested
Op - An atomic operation on a one-to-many or one-to-one child relation.
Traits§
- AnyNested
Write - Object-safe interface for any nested write attached to a parent model
M.
Functions§
- delete
- Compile a
DELETEforM. - dialect_
for_ pool - Build a
&'static dyn DbDialectfrom aPool. - insert
- Compile an
INSERTforM. - insert_
many - Compile a multi-row
INSERTforM. - sanitize_
sql - Sanitizes a SQL string by stripping literal values (strings, numbers) to ensure PII safety.
- select
- Compile a
SELECTforM. - update
- Compile an
UPDATEforM.
Type Aliases§
- BoxFuture
- A boxed future, used by the transaction escape hatch.