resolute-derive
Proc-macro crate backing the #[derive(...)] and attribute macros
exposed at the resolute crate root. You don't need
to depend on this directly: re-exports live in resolute itself.
What it provides
#[derive(FromRow)]: map a row (fromquery,query!, a stream, or COPY) into a struct. Field attributes:rename,skip,default,json(serde round-trip),try_from = "T",flatten(compose nested structs).#[derive(PgEnum)]: PostgreSQL enum types. Works in#[repr(i32)]mode too, which is handy for legacy schemas where the status column is a bare integer.#[derive(PgComposite)]: custom composite types, including their array OIDs.#[derive(PgDomain)]: newtypes over a base SQL type, with automatic array-OID inheritance.#[resolute::test]: test attribute that spins up a temporary database, runs migrations, hands the test aClient, and cleans up on completion.
Usage
use FromRow;
Testing
resolute-derive has no dedicated test target. Instead:
- Successful expansion is exercised by every derive in the
resolutecrate's tests (~378 tests inresolute/tests/), which import the macros and rely on the generated code at runtime. - Compile-time failure is covered by trybuild fixtures in
resolute/tests/compile_fail_derive/, run byderive_compile_fail_testsinresolute/tests/compile_fail_derive_test.rs. Each.rsfixture has a paired.stderrsnapshot that the harness diffs against the actual compiler output.
This setup catches both "the macro produced wrong code" (via downstream
runtime tests) and "the macro accepted invalid input" (via trybuild)
without requiring a separate tests/ directory inside this crate.
License
Dual licensed under Apache 2.0 or MIT. See the workspace root for the broader project.