This directory contains runnable examples covering the main xpg usage patterns.
| Example | Covers |
|---|---|
basic |
Core xpg.Pool usage for common PostgreSQL operations |
transactions |
Transactions, savepoints, and recovering from an optional operation failure |
advisory |
Coordinating concurrent work with transaction-level advisory locks |
observability |
slog logging, OpenTelemetry tracing, and Prometheus pool metrics |
cluster |
Primary and replica routing, round-robin reads, and read-only transactions |
shard |
Range-based shard routing and shard-local reads and writes |
shard_group |
Multi-key colocation checks and per-shard batch operations |
shard_geo |
Custom geographic routing built from shard metadata |
Each example is self-contained and includes its own setup and run instructions.
Open the corresponding directory and follow its README.