Skip to main content

ConnectionInit

Type Alias ConnectionInit 

Source
pub type ConnectionInit<DB> = Arc<dyn for<'a> Fn(&'a mut <DB as Database>::Connection, PoolConnectionMetadata) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> + Send + Sync>;
Expand description

Shared custom callback invoked on every fresh physical connection.

Return an error to reject the connection; SQLx closes it and retries within its acquisition deadline. Leave no transaction or lock open. Mandatory adapter settings run afterwards and may override conflicting values. Callback messages are subject to SQLx’s own error logging.

Aliased Type§

pub struct ConnectionInit<DB> { /* private fields */ }