pgsqlrepository

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 14 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 {
	MaxIdleConns    int
	MaxOpenConns    int
	ConnMaxIdleTime time.Duration
	ConnMaxLifetime time.Duration
}

Config contais PgSQL configuration value.

type Repository

Repository represents a PgSQL repository implementation.

func New

func New(host, username, password, database, sslMode string, cfg Config) *Repository

New creates and returns an initialized PgSQL Repository instance.

func (*Repository) InTransaction

func (r *Repository) InTransaction(ctx context.Context, f func(ctx context.Context, tx repository.Transaction) error) error

InTransaction generates a PgSQL transaction and completes it after it's being used by f function.

func (*Repository) Start

func (r *Repository) Start(ctx context.Context) error

Start implements Start interface method.

func (*Repository) Stop

func (r *Repository) Stop(_ context.Context) error

Stop closes PgSQL database and prevents new queries from starting.

Jump to

Keyboard shortcuts

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