Expand description
The application’s Toasty database.
Models are Rust structs with #[derive(toasty::Model)]; this module opens
the connection pool they run on, on PostgreSQL. Configure it with
DATABASE_URL (default DEFAULT_URL). Several processes and machines
can share the database.
Schema changes are Toasty migrations: generated from the models by the
app’s migrate binary (built on toasty-cli) and applied by it.
Structs§
- Database
Config - Where to connect.
Enums§
- Isolation
Level - Transaction isolation levels, for
toasty::TransactionBuilder::isolation.Serializabletransactions may fail with a serialization failure under contention; retry them (SERIALIZABLE_ATTEMPTS). SQL transaction isolation levels.
Constants§
- DEFAULT_
URL - The database used when
DATABASE_URLis not set: a local PostgreSQL. - SERIALIZABLE_
ATTEMPTS - How many times to run a
Serializabletransaction that keeps failing with a serialization failure before giving up. - URL_ENV
- Environment variable holding the database URL.
Functions§
- connect
- Opens a pooled handle to the database for
models. Cheap to clone: clones share the pool.