postgres

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr         string `validate:"required,hostname_port" example:"localhost:5432"`
	User         string `validate:"required" secret:"true"`
	Password     string `validate:"required" secret:"true"`
	DBName       string `yaml:"db_name" validate:"required" env:"DB_NAME"`
	PingInterval int    `yaml:"ping_interval" validate:"required,gt=0" default:"10"`
	MinConns     int32  `yaml:"min_conns" validate:"required,gt=0" default:"3"`
	MaxConns     int32  `yaml:"max_conns" validate:"required,gt=0" default:"6"`
}

type Postgres

type Postgres struct {
	DB *pgxpool.Pool
}

func New

func New(ctx context.Context, cfg Config, l logger) (*Postgres, error)

func (*Postgres) Name

func (s *Postgres) Name() string

func (*Postgres) Ping

func (s *Postgres) Ping(ctx context.Context) error

func (*Postgres) Start

func (s *Postgres) Start(_ context.Context) error

func (*Postgres) Stop

func (s *Postgres) Stop(_ context.Context) error

Jump to

Keyboard shortcuts

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