An [sql!] macro to write compile-time checked database queries similar to how [format!]
works.
Example
use ;
#
# async
Usage
- Add
sqlm-postgresto your dependencies - Make the
DATABASE_URLenv variable available during compile time (e.g. via adding an.envfile) - Start using the [
sql!] macro (no further setup necessary; a connection pool is automatically created for you)
Caveats
- Automatically creates a global connection pool for you with no way to opt out
- Compile-time checks cannot be disabled. Thus also requires database access on your CI.
- Does not know whether rows returned from Postgres are nullable and consequentially
requires all types to implement [
Default::default], which it falls back to if Postgres returns null.