Expand description
Derive macros for rok-db. Use them through the
rok-db crate rather than depending on this crate directly.
Attribute Macros§
- test
- Run an async test against a fresh, temporary database (feature
testing). The database is created on the server named byDATABASE_URL, passed in as aDb, and dropped afterwards — even if the test panics. WithoutDATABASE_URLthe test is skipped.
Derive Macros§
- DbEnum
- Derive a column type for a field-less enum, stored as
TEXT(default) or as a native PostgreSQL enum. - DbNewtype
- Derive a column type for a single-field tuple struct (a “newtype”), stored exactly like its inner type:
- FromRow
- Derive
sqlx::FromRowfor decoding query results into a plain struct, e.g. the output ofSelect::selectwith aliased projections — without depending on sqlx directly. - Model
- Derive
rok_db::Model(andsqlx::FromRow) for a struct with named fields.