postgres

package
v0.0.0-...-e083d15 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package postgres provides a thin wrapper around database/sql with connection-pool configuration, health-check support, and a transactional helper (InTx).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

Client manages a PostgreSQL connection pool.

func New

func New(cfg config.PostgresConfig) (*Client, error)

New opens a PostgreSQL connection pool, configures its limits, and pings the server to verify connectivity.

func (*Client) Close

func (c *Client) Close() error

Close releases the database connection pool.

func (*Client) InTx

func (c *Client) InTx(ctx context.Context, fn func(tx *sql.Tx) error) error

InTx executes fn inside a database transaction. On error the transaction is rolled back; on success it is committed.

Jump to

Keyboard shortcuts

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