pub struct SqlxConfig {Show 15 fields
pub url: String,
pub username: Option<String>,
pub password: Option<String>,
pub table: String,
pub insert_query: Option<String>,
pub select_query: Option<String>,
pub delete_after_read: bool,
pub auto_create_table: bool,
pub polling_interval_ms: Option<u64>,
pub tls: TlsConfig,
pub max_connections: Option<u32>,
pub min_connections: Option<u32>,
pub acquire_timeout_ms: Option<u64>,
pub idle_timeout_ms: Option<u64>,
pub max_lifetime_ms: Option<u64>,
}Expand description
General SQLx connection configuration.
Fields§
§url: StringDatabase connection URL.
username: Option<String>Optional username. Takes precedence over any credentials embedded in the url.
password: Option<String>Optional password. Takes precedence over any credentials embedded in the url.
table: StringThe table to interact with.
insert_query: Option<String>(Publisher only) Optional. A custom SQL INSERT query. Use ? as a placeholder for the payload.
If not provided, a default INSERT INTO {table} (payload) VALUES (?) is used.
select_query: Option<String>(Consumer only) Optional. A custom SQL SELECT query to fetch messages. This is only supported for PostgreSQL and Microsoft SQL Server.
The query must include a placeholder for the batch size ($1 for PostgreSQL, @p1 for SQL Server).
The bridge will bind the route’s batch_size to this placeholder.
delete_after_read: bool(Consumer only) If true, delete messages after processing.
auto_create_table: bool(Publisher only) If true, automatically create the table and indexes if they don’t exist. Defaults to false.
polling_interval_ms: Option<u64>(Consumer only) Polling interval in milliseconds. Defaults to 100ms.
tls: TlsConfigTLS configuration for the database connection.
max_connections: Option<u32>Maximum number of connections in the pool. Defaults to 10.
min_connections: Option<u32>Minimum number of connections to keep in the pool. Defaults to 0.
acquire_timeout_ms: Option<u64>Timeout for acquiring a connection from the pool in milliseconds. Defaults to 30000ms.
idle_timeout_ms: Option<u64>Maximum idle time for a connection in milliseconds. Defaults to 600000ms (10 minutes).
max_lifetime_ms: Option<u64>Maximum lifetime of a connection in milliseconds. Defaults to 1800000ms (30 minutes).
Trait Implementations§
Source§impl Clone for SqlxConfig
impl Clone for SqlxConfig
Source§fn clone(&self) -> SqlxConfig
fn clone(&self) -> SqlxConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more