pgkit

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PgError

func PgError(err error) (bool, error)

PgError checks if the error is a Postgres error and returns true if it is. If it is, it returns the error wrapped with the appropriate error from errkit package. Otherwise, it returns false and the original error.

Types

type Conn

type Conn struct{ *pgxpool.Pool }

Conn represents connection to Postgres.

func New

func New(connstr string) (*Conn, error)

New returns a pointer to a new instance of *Conn structure. Takes connstr - connection string in Postgres format.

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection to the Postgres database.

func (*Conn) Health

func (c *Conn) Health(ctx context.Context) error

Health checks if the connection is healthy.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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