Skip to main content

Crate rok_db_macros

Crate rok_db_macros 

Source
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 by DATABASE_URL, passed in as a Db, and dropped afterwards — even if the test panics. Without DATABASE_URL the 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::FromRow for decoding query results into a plain struct, e.g. the output of Select::select with aliased projections — without depending on sqlx directly.
Model
Derive rok_db::Model (and sqlx::FromRow) for a struct with named fields.