postgres

package module
v0.0.0-...-4ddf07d Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package postgres provides PostgreSQL database connection and migration utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URI             string
	Timeout         time.Duration
	MaxIdleConns    int
	MaxIdleTime     time.Duration
	MaxConnLifetime time.Duration
	AutoMigrate     bool
	MigrationsFS    fs.FS
	MigrationsPath  string
}

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(cfg Config) (*Connection, error)

func (*Connection) Close

func (c *Connection) Close() error

Close closes the connection pool

func (*Connection) Ping

func (c *Connection) Ping(ctx context.Context) error

Ping checks the connection to the database

func (*Connection) Pool

func (c *Connection) Pool() *pgxpool.Pool

Pool returns the pgxpool.Pool instance

Jump to

Keyboard shortcuts

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