Modules§
- Generic database driver with the specific driver selected at runtime.
- Traits to represent a database driver.
- Provides
Decodefor decoding values from the database. - Provides
Encodefor encoding values for the database. - Types for working with errors produced by SQLx.
- mssql
mssqlMicrosoft SQL (MSSQL) database driver. - mysql
mysqlMySQL database driver. - Provides the connection pool for asynchronous SQLx connections.
- postgres
postgresPostgreSQL database driver. - Convenience re-export of common traits.
- Types and traits for the
queryfamily of functions and macros. - Runtime query-builder API.
- sqlite
sqliteSQLite database driver. - Conversions between Rust and SQL types.
Macros§
- Embeds migrations into the binary by expanding to a static instance of Migrator.
- query
macrosStatically checked SQL query withprintln!()style syntax. - query_
as macrosA variant of [query!] which takes a path to an explicitly defined struct as the output type. - query_
as_ unchecked macrosA variant of [query_as!] which does not check the input or output types. This still does parse the query to ensure it’s syntactically and semantically valid for the current database. - query_
file macrosA variant of [query!] where the SQL query is stored in a separate file. - query_
file_ as macrosCombines the syntaxes of [query_as!] and [query_file!]. - query_
file_ as_ unchecked macrosA variant of [query_file_as!] which does not check the input or output types. This still does parse the query to ensure it’s syntactically and semantically valid for the current database. - query_
file_ scalar macrosA variant of query_scalar! which takes a file path like [query_file!]. - A variant of query_file_scalar! which does not typecheck bind parameters and leaves the output type to inference. The query itself is still checked that it is syntactically and semantically valid for the database, that it only produces one column and that the number of bind parameters is correct.
- query_
file_ unchecked macrosA variant of [query_file!] which does not check the input or output types. This still does parse the query to ensure it’s syntactically and semantically valid for the current database. - query_
scalar macrosA variant of [query!] which expects a single column from the query and evaluates to an instance of QueryScalar. - query_
scalar_ unchecked macrosA variant of query_scalar! which does not typecheck bind parameters and leaves the output type to inference. The query itself is still checked that it is syntactically and semantically valid for the database, that it only produces one column and that the number of bind parameters is correct. - query_
unchecked macrosA variant of [query!] which does not check the input or output types. This still does parse the query to ensure it’s syntactically and semantically valid for the current database.
Structs§
- Opaque database driver. Capable of being used in place of any SQLx database driver. The actual driver used will be selected at runtime, from the connection url.
- A connection to any SQLx database.
- Mssql
mssqlMSSQL database driver. - Mssql
Connection mssql - MySql
mysqlMySQL database driver. - MySql
Connection mysqlA connection to a MySQL database. - PgConnection
postgresA connection to a PostgreSQL database. - An asynchronous pool of SQLx database connections.
- Postgres
postgresPostgreSQL database driver. - A builder type for constructing queries at runtime.
- Sqlite
sqliteSqlite database driver. - Sqlite
Connection sqliteA connection to an open Sqlite database. - An in-progress database transaction or savepoint.
Enums§
- The enum
Eitherwith variantsLeftandRightis a general purpose sum type with two cases. - Represents all the ways a method can fail within SQLx.
Traits§
- Acquire connections or transactions from a database in a generic way.
- An alias for
Executor<'_, Database = Any>. - A tuple of arguments to be sent to the database.
- Represents a single database connection.
- A database driver.
- A type that can be decoded from the database.
- Encode a single value to be sent to the database.
- A type that may be executed against a database connection.
- A type that contains or can provide a database connection to use for executing queries against the database.
- A record that can be built from a row returned by the database.
- Mssql
Executor mssqlAn alias forExecutor<'_, Database = Mssql>. - MySql
Executor mysqlAn alias forExecutor<'_, Database = MySql>. - PgExecutor
postgresAn alias forExecutor<'_, Database = Postgres>. - Represents a single row from the database.
- Sqlite
Executor sqliteAn alias forExecutor<'_, Database = Sqlite>. - An explicitly prepared statement.
- Indicates that a SQL type is supported for a database.
- Provides information about a SQL type for the database driver.
- An owned value from the database.
- A reference to a single value from the database.
Functions§
- Make a SQL query.
- Make a SQL query that is mapped to a concrete type using
FromRow. - Make a SQL query, with the given arguments, that is mapped to a concrete type using
FromRow. - Make a SQL query that is mapped to a single concrete type using
FromRow. - Make a SQL query, with the given arguments, that is mapped to a single concrete type using
FromRow. - Make a SQL query, with the given arguments.
Type Aliases§
- Mssql
Pool mssqlAn alias forPool, specialized for MSSQL. - MySql
Pool mysqlAn alias forPool, specialized for MySQL. - PgPool
postgresAn alias forPool, specialized for Postgres. - A specialized
Resulttype for SQLx. - Sqlite
Pool sqliteAn alias forPool, specialized for SQLite.
Attribute Macros§
- Mark an
async fnas a test with SQLx support.