postgres

package
v0.1.1-dev Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package postgres provides the kit's production storage backend over pgx/v5's database/sql driver (R7). Per-account write concurrency: sequence reservation serializes on a chain_account_locks row via INSERT … ON CONFLICT DO NOTHING + SELECT … FOR UPDATE (AcquireAccountLock), so different (chain_id, source_address) accounts reserve concurrently while one account's reservations are strictly ordered. The schema's UNIQUE constraints remain the last-line guarantee.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireAccountLock

func AcquireAccountLock(ctx context.Context, tx *sql.Tx, chainID, sourceAddress string) error

AcquireAccountLock serializes work for one (chain_id, source_address) inside tx: it creates the chain_account_locks row on demand, then takes a row lock held until the transaction ends (data model §6 lock key CHAIN_ACCOUNT:{chain_id}:{source_address}).

func Open

func Open(dsn string) (storage.Store, error)

Open connects to PostgreSQL at dsn (any pgx-accepted DSN or URL), applies the embedded migrations, and returns the storage.Store aggregate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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