Skip to main content

Module sqlx

Module sqlx 

Source
Expand description

Compatibility shim that exposes a sqlx-shaped API by re-exporting from sqlx-core + sqlx-postgres directly.

Why this shim exists: depending on the sqlx umbrella crate transitively pulls sqlx-sqlite into the resolve graph (Cargo’s resolver materialises the optional dep even when no feature activates it), which pins libsqlite3-sys ^0.30.1 and conflicts with rusqlite 0.39’s libsqlite3-sys ^0.37 via the links = "sqlite3" rule. Going direct to the split crates side-steps the leak entirely. Downstream users keep writing cratestack::sqlx::X paths; macro emissions stay unchanged.

SemVer caveat: sqlx-core documents itself as “not meant for general use” without SemVer guarantees. The surface re-exported here is the narrow subset the umbrella sqlx crate exposes, which is stable in practice across 0.8.x. If sqlx-core breaks at a 0.8 patch, this shim adapts in one place.

Re-exports§

pub use sqlx_postgres as postgres;

Modules§

database
Traits to represent a database driver.
decode
encode
error
Types for working with errors produced by SQLx.
migrate
pool
Provides the connection pool for asynchronous SQLx connections.
query_builder
Runtime query-builder API.
types

Structs§

PgConnection
A connection to a PostgreSQL database.
Pool
An asynchronous pool of SQLx database connections.
Postgres
PostgreSQL database driver.
QueryBuilder
A builder type for constructing queries at runtime.
RawSql
One or more raw SQL statements, separated by semicolons (;).
Transaction
An in-progress database transaction or savepoint.

Enums§

Either
The enum Either with variants Left and Right is a general purpose sum type with two cases.
Error
Represents all the ways a method can fail within SQLx.

Traits§

Acquire
Acquire connections or transactions from a database in a generic way.
Arguments
A tuple of arguments to be sent to the database.
Column
ColumnIndex
A type that can be used to index into a Row or Statement.
ConnectOptions
Connection
Represents a single database connection.
Database
A database driver.
Decode
A type that can be decoded from the database.
Encode
Encode a single value to be sent to the database.
Execute
A type that may be executed against a database connection.
Executor
A type that contains or can provide a database connection to use for executing queries against the database.
FromRow
A record that can be built from a row returned by the database.
IntoArguments
PgExecutor
An alias for Executor<'_, Database = Postgres>.
Row
Represents a single row from the database.
Statement
An explicitly prepared statement.
Type
Indicates that a SQL type is supported for a database.
TypeInfo
Provides information about a SQL type for the database driver.
Value
An owned value from the database.
ValueRef
A reference to a single value from the database.

Functions§

query
Execute a single SQL query as a prepared statement (transparently cached).
query_as
Execute a single SQL query as a prepared statement (transparently cached). Maps rows to Rust types using FromRow.
query_as_with
Execute a single SQL query, with the given arguments as a prepared statement (transparently cached). Maps rows to Rust types using FromRow.
query_scalar
Execute a single SQL query as a prepared statement (transparently cached) and extract the first column of each row.
query_scalar_with
Execute a SQL query as a prepared statement (transparently cached), with the given arguments, and extract the first column of each row.
query_with
Execute a SQL query as a prepared statement (transparently cached), with the given arguments.
raw_sql
Execute one or more statements as raw SQL, separated by semicolons (;).

Type Aliases§

PgPool
An alias for Pool, specialized for Postgres.
PgTransaction
An alias for Transaction, specialized for Postgres.
Result
A specialized Result type for SQLx.