Dispatch

PostgreSQL Store

Production-ready PostgreSQL store using grove ORM with pgdriver.

The store/postgres package implements Dispatch's store interfaces using the grove ORM with the PostgreSQL driver. It is the recommended store for production deployments.

Usage

import (
    "github.com/xraph/grove"
    "github.com/xraph/grove/drivers/pgdriver"
    "github.com/xraph/dispatch/store/postgres"
)

db, err := grove.Open(pgdriver.Open("postgres://user:pass@localhost:5432/dispatch?sslmode=disable"))
if err != nil {
    log.Fatal(err)
}

s := postgres.New(db)
if err := s.Migrate(ctx); err != nil {
    log.Fatal(err)
}

d, err := dispatch.New(dispatch.WithStore(s))

Migrations

Call s.Migrate(ctx) before first use. This creates all required tables and indexes. Migrations are idempotent -- safe to run on every startup.

Internals

AspectDetail
Drivergrove ORM + pgdriver
Migrationsgrove orchestrator with embedded SQL migrations
TransactionsDatabase-level ACID
Pingdb.Ping(ctx)
CloseNo-op -- caller owns the *grove.DB lifecycle

When to use

  • Production deployments requiring ACID transactions and full SQL query power.
  • Multi-process environments with connection pooling.
  • When you need durable storage for jobs, workflows, and events.

On this page