Skip to main content

Module sql

Module sql 

Source

Re-exportsยง

pub extern crate sqlx;

Modulesยง

db ๐Ÿ”’
migrate ๐Ÿ”’
queries ๐Ÿ”’
Immutable query functionality of a SQL database.
syntax_helpers
testing
transaction ๐Ÿ”’
SQL transactions

Macrosยง

include_dir
Embed the contents of a directory in your crate.
include_migrations
Embed migrations from the given directory into the current binary for PostgreSQL or SQLite.

Structsยง

Backfill
Marker type indicating a transaction used for deferred-migration batches.
Config
Error
The Error type, a wrapper around a dynamic error type.
Migration
Represents a schema migration to be run on the database, this struct is used by the embed_migrations! macro to gather migration files and shouldnโ€™t be needed by the user
Prune
Marker type indicating a transaction used for pruning deletes.
PruneState ๐Ÿ”’
Pruner
QueryBuilder
Helper type for programmatically constructing queries.
Read
Marker type indicating a transaction with read-only access to the database.
SerializableRetryConfig
Retry policy for transactions aborted by PostgreSQL serialization conflicts (SQLSTATE 40001).
SqlStorage
Storage for the APIs provided in this crate, backed by a remote PostgreSQL database.
Sqlite
Sqlite database driver.
Transaction
An atomic SQL transaction.
Write
Marker type indicating a transaction with read-write access to the database.

Enumsยง

PruneCategory ๐Ÿ”’
StorageConnectionType

Traitsยง

Database
A database driver.
Executor
A type that contains or can provide a database connection to use for executing queries against the database.
FixedLengthParams
A collection of parameters with a statically known length.
Params
A collection of parameters which can be bound to a SQL query.
TransactionMode
Trait for marker types indicating what type of access a transaction has to the database.

Functionsยง

add_custom_migrations ๐Ÿ”’
Add custom migrations to a default migration sequence.
build_where_in
default_migrations
The migrations required to build the default schema for this version of SqlStorage.
is_serialization_conflict_err ๐Ÿ”’
Returns true if errโ€™s Display output identifies it as a PostgreSQL serialization conflict (SQLSTATE 40001, message โ€œcould not serialize accessโ€).
query
query_as
serialization_conflict_with_diag ๐Ÿ”’
Like is_serialization_conflict_err but also logs concurrent DB sessions for diagnostics.
set_no_deferrable_on_read
Configure whether read transactions on Postgres should omit DEFERRABLE.
spawn_pg_stat_activity_log ๐Ÿ”’
Spawn a background task that queries pg_stat_activity and pg_locks to identify the connections and predicate locks involved in a serialization conflict, logging them at warn.
validate_migrations ๐Ÿ”’
Validate and preprocess a sequence of migrations.

Type Aliasesยง

Db
Query
QueryAs