Skip to main content

Crate rxferrix_macros

Crate rxferrix_macros 

Source
Expand description

Procedural macros for rxferrix: #[table], #[object], #[query], #[mutation], #[action], the internal_* variants, #[workflow], and #[migration].

The expansions are specified normatively in docs/CONTRACT.md §3. Every path the expansions use is fully qualified (::core::.., ::std::.., ::rxferrix::..), so use items in user code cannot change their meaning.

Notes for users:

  • #[table] adds #[derive(Serialize, Deserialize, TS, Clone, Debug)] itself. Deriving any of these again is a compile error. Put #[table] before any #[derive] and #[index] attributes.
  • After #[query] (etc.), the fn is kept as is (still directly callable). A braced struct with the same name (pub struct list {}, type namespace only) is the function reference: ctx.run_query::<list>(args).

Attribute Macros§

action
Declares a public action function. See docs/CONTRACT.md §3.2. Takes dev_only like #[query].
internal_action
Declares an action that cannot be called by clients. See docs/CONTRACT.md §3.2.
internal_mutation
Declares a mutation that cannot be called by clients. See docs/CONTRACT.md §3.2.
internal_query
Declares a query that cannot be called by clients. See docs/CONTRACT.md §3.2.
migration
Declares a data migration over one table, run in batches. See docs/CONTRACT.md §1.9 and §3.3.
mutation
Declares a public mutation function. See docs/CONTRACT.md §3.2. Takes dev_only like #[query].
object
A type used in function signatures that is not a table: a function’s output (a “view” struct), an argument, or a type nested in either. See docs/CONTRACT.md §3.4.
query
Declares a public query function. See docs/CONTRACT.md §3.2. #[query(dev_only)]: refused unless the server runs with --dev, and generated into devApi instead of api.
table
Declares a table document type. See docs/CONTRACT.md §3.1.
workflow
Declares a durable workflow: an async fn taking step: &WorkflowCtx whose steps (step.run_query, run_mutation, run_action, sleep, wait_for_event) are journaled, so it survives restarts and can run for days. Started with ctx.workflows.start::<name>(args). See rxferrix::workflow.