Old

📦 db.Store – Transactional Data Layer for Synapse

The Store type wraps db.Queries with support for complex multi-step transactional workflows. It uses pgxpool.Pool to manage PostgreSQL connections and ensures ACID guarantees through explicit transaction boundaries.


🔧 Core Types

Store

type Store struct {
	*Queries
	dbpool *pgxpool.Pool
}

A high-level abstraction around Queries for executing grouped operations inside a transaction.


NewStore

func NewStore(dbpool *pgxpool.Pool) *Store

Creates a new instance of Store with access to query methods and transaction support.


execTx

func (s *Store) execTx(ctx context.Context, fn func(*Queries) error) error

Executes the given function within a database transaction.

Used internally to ensure data consistency across multiple operations.