API reference
Edit this pagePosted: 2026-09-12 · Report this thread
Everything a program spells lives in github.com/agentstax/sqlstreams/client:
one client over your pool, a handle per resource named from it, the verbs on
the handle they act on. The shape of the API explains
why it looks that way; this board is the lookup table.
| you hold | you get it from | verbs | thread |
|---|---|---|---|
Client | sqlstreams.NewClient(ctx, pool, cfg) | Streams, Stream, Schedulers, Scheduler, System, Manager, InTransaction | Client |
*pgxpool.Pool | sqlstreams.NewPostgresPool or pgxpool.New | yours to close | Postgres pool |
StreamHandle[T] | client.Stream[T](name) | Register, Get, Migrate, MigrationVersion, Rename, Destroy, Health, CompactionHeads, Consumers, and the handles under it | Stream |
KeyHandle[T] | stream.Key(messageKey) | CompactionHead, LockCompactionHead, Messages | Message key |
ConsumerHandle[T], ConsumerInstance[T] | stream.Consumer(name), then Register | Register, Get, Workers, Destroy, Binding; Consume | Consumer |
ProducerHandle[T], ProducerInstance[T] | stream.Producer(), then Register | Register; Produce, ProduceBatch, ProduceFunc, ProduceInTx, ProduceFuncInTx | Producer |
SchedulerHandle, SchedulerInstance[T] | client.Scheduler(name), then Register | Register, Get, Suspend, Unsuspend, Run, Status, Messages, Destroy; Schedule | Scheduler |
SystemHandle | client.System() | Register, Get, Migrate, MigrationVersion, MigrateStreams, Destroy, Bindings | System |
ManagerHandle | client.Manager() | Run | Manager |
| the metrics handles | .Metrics() on the system, a stream, a consumer | Definitions, Snapshot, Latest, History, the built-in selectors, Metric, Producer | Metrics |
| the alert handles | .Alerts() on the system, a stream, a consumer | Definitions, Latest, History, the built-in selectors, Alert | Alerts |
MessageOptions, RetryPolicy | literals inside configs and options | Fill, Clamp, ResolveConcurrency, Equal; CalculateDelay, CalculateTotalDelay | Message options |
DiagnosticError, DiagnosticEvent, Owner | returned errors, the Err* and Event* variables | GetCode, Recovery, Problem, Fix, With, errors.Is | Errors and events |
Every thread reads the same way: what the value is and how you get one, its
verbs, its config fields with their defaults, then the traps. A SQL code in a
table links to that code’s own thread on
Troubleshooting.