Skip to main content

Module db

Module db 

Source
Expand description

Database connectivity.

The pool is sqlx::Any, so a deployment runs on Postgres, MySQL, or SQLite by its configured URL. Db pairs the pool with the concrete DbBackend (inferred from the URL) so the query and migration layers can render SQL for the running backend.

Structs§

Db
An application database handle: the connection pool plus the backend it speaks. Cheap to clone (the pool is reference-counted).

Functions§

connect
Creates the application database handle from configuration. Installs the sqlx::Any drivers on first use so any supported backend can be dialled.