postgres

package
v0.0.0-...-98b2a73 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Array

func Array(start int, len int) string

func Error

func Error(err error, resource string, index string) error

func Tx

func Tx(ctx context.Context) (pgx.Tx, error)

Types

type Config

type Config struct {
	Host string `json:"host" env:"POSTGRES_HOST" env-default:"0.0.0.0"`
	Port string `json:"port" env:"POSTGRES_PORT"`

	User     string `json:"user" env:"POSTGRES_USER"`
	Password string `json:"password" env:"POSTGRES_PASSWORD"`

	DBName string `json:"db_name" env:"POSTGRES_DB_NAME"`
}

Config is POSTGRES structure config.

type ErrUnknownEnumValue

type ErrUnknownEnumValue struct {
	Enum  string
	Value string
}

func (ErrUnknownEnumValue) Error

func (e ErrUnknownEnumValue) Error() string

type Service

type Service struct {
	*pgxpool.Pool
}

Service wraps a postgres client.

func (*Service) Close

func (s *Service) Close(ctx context.Context) error

func (*Service) Dial

func (s *Service) Dial(ctx context.Context, cfg Config) error

Dial connects postgres server.

func (Service) Tx

Jump to

Keyboard shortcuts

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