database

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: BSD-3-Clause Imports: 9 Imported by: 2

Documentation

Overview

Package database is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockPostgreClientItf

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

MockPostgreClientItf is a mock of PostgreClientItf interface.

func NewMockPostgreClientItf

func NewMockPostgreClientItf(ctrl *gomock.Controller) *MockPostgreClientItf

NewMockPostgreClientItf creates a new mock instance.

func (*MockPostgreClientItf) Close

func (m *MockPostgreClientItf) Close()

Close mocks base method.

func (*MockPostgreClientItf) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPostgreClientItf) Get

Get mocks base method.

type MockPostgreClientItfMockRecorder

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

MockPostgreClientItfMockRecorder is the mock recorder for MockPostgreClientItf.

func (*MockPostgreClientItfMockRecorder) Close

Close indicates an expected call of Close.

func (*MockPostgreClientItfMockRecorder) Get

func (mr *MockPostgreClientItfMockRecorder) Get(ctx interface{}) *gomock.Call

Get indicates an expected call of Get.

type PGXClient

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

func NewPGXClient

func NewPGXClient(ctx context.Context, config *PostgreConfiguration) (*PGXClient, error)

NewPGXClient creates a postgre client using pgx.

func (*PGXClient) Close

func (p *PGXClient) Close()

Close closes all connection to the postgres.

func (*PGXClient) Get

func (p *PGXClient) Get(_ context.Context) (*pgxpool.Pool, error)

Get returns connection client to postgres.

type PostgreClientItf

type PostgreClientItf interface {
	// Get returns connection client to postgres.
	Get(ctx context.Context) (*pgxpool.Pool, error)
	// Close closes all connection to the postgres.
	Close()
}

PostgreClientItf is a client to interact with PostgreSQL database using pgx.

type PostgreConfiguration

type PostgreConfiguration struct {
	// Address is database connection address.
	// e.g. user=unicorn_user password=magical_password dbname=application_name host=127.0.0.1 port=5432 sslmode=disable
	Address string
	// MinConnection is the minimum size of the pool.
	// The health check will increase the number of connections to this
	// amount if it had dropped below.
	MinConnection int32
	// MaxConnection is the maximum size of the pool.
	MaxConnection int32
	// MaxConnectionLifetime is the duration since creation after which a connection will be automatically closed.
	// Time: second.
	MaxConnectionLifetime int64
	// MaxConnectionIdleTime is the duration after which an idle connection will be automatically closed by the health check.
	// Time: second.
	MaxConnectionIdleTime int64
}

Jump to

Keyboard shortcuts

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