projection

command
v1.0.0-beta.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package main sketches the recommended way to combine Postgres and DynamoDB: Postgres is the authoritative event store (it provides the global ordered feed and crash-safe subscriptions), and DynamoDB holds a read model built by a background subscriber. Crash recovery happens from Postgres — after a restart the subscriber resumes from its checkpoint and re-applies events to DynamoDB.

The DynamoDB projection is at-least-once, NOT exactly-once: a DynamoDB write cannot join the subscriber's Postgres batch transaction, so a crash mid-batch redelivers events. The handler is therefore made idempotent with a conditional write keyed on the global feed position — replays are no-ops and application stays monotonic.

Run with live infrastructure:

POSTGRES_DSN=postgres://... DYNAMO_PROJECTION_TABLE=accounts \
  AWS_REGION=us-east-1 go run ./examples/projection/

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL