db.Store – Transactional Data Layer for SynapseThe 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.
Storetype Store struct {
*Queries
dbpool *pgxpool.Pool
}
A high-level abstraction around Queries for executing grouped operations inside a transaction.
NewStorefunc NewStore(dbpool *pgxpool.Pool) *Store
Creates a new instance of Store with access to query methods and transaction support.
execTxfunc (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.