data-plane DSL PostgreSQL 18 source only

Queues and tables for durable workflow data, changed by typed programs that run as plain SQL.

Declare a space's queues, tables and reads in a schema document. Change them with programs: lists of typed statements, such as claim, settle, update and select, that run in order as one transaction. The PostgreSQL executor turns each statement into one SQL statement and keeps nothing in the process between calls.

Two documents

Schema

Queues, tables and sequenced tables with typed fields, indexes, merge rules, retention and named, versioned reads. Each object becomes a real table. Changes only add.

Program

insert, claim, settle, renew, update, delete, assert, select, read, pause and resume. Predicates and assignments are typed data, never SQL text.

Checked, then lowered

A program is checked against the schema: names resolve, types match with no implicit casts, and every selection uses an index. Then each statement becomes one SQL statement with bound parameters.

The database does the work

Indexes choose rows

A where must test an indexed column. A claim reads the (due_at, priority, id) claim index, so it reads about limit entries however many items are sleeping.

Row locks order writers

Claims skip rows other transactions hold. Guards lock the rows they count, so a counted row can't change before the program commits.

Its clock decides what is due

Due items, lapsed leases and retention are conditions on stored times, read against the database's clock. No caller drives a tick.

PostgreSQL 18 is the first and currently only executor. The crates fireweed-dsl and fireweed-dsl-postgres are on crates.io. See support.

Examples

Enqueue, claim, settle

Insert three sends, lease the due ones in claim order, then complete one and retry the other in the same program.

Read the example →

Guarded updates with expect

Create a keyed row once, advance it with compare-and-set on its version, and enqueue a send only when a guard finds no suppression row.

Read the example →

Indexed counts

Count a queue by state and by campaign with no where clause, and run the same count for one campaign through a declared read.

Read the example →