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 ¶
func (m *MockPostgreClientItf) EXPECT() *MockPostgreClientItfMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockPostgreClientItfMockRecorder ¶
type MockPostgreClientItfMockRecorder struct {
// contains filtered or unexported fields
}
MockPostgreClientItfMockRecorder is the mock recorder for MockPostgreClientItf.
func (*MockPostgreClientItfMockRecorder) Close ¶
func (mr *MockPostgreClientItfMockRecorder) Close() *gomock.Call
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.
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
}
Click to show internal directories.
Click to hide internal directories.