Documentation ¶
Overview ¶
Package database is a generated GoMock package.
Index ¶
- type MockPostgreClientItf
- func (m *MockPostgreClientItf) Close()
- func (m *MockPostgreClientItf) EXPECT() *MockPostgreClientItfMockRecorder
- func (m *MockPostgreClientItf) Get(ctx context.Context) (*pgxpool.Pool, error)
- func (m *MockPostgreClientItf) GetReader(ctx context.Context) (*pgxpool.Pool, error)
- func (m *MockPostgreClientItf) GetWriter(ctx context.Context) (*pgxpool.Pool, error)
- type MockPostgreClientItfMockRecorder
- func (mr *MockPostgreClientItfMockRecorder) Close() *gomock.Call
- func (mr *MockPostgreClientItfMockRecorder) Get(ctx interface{}) *gomock.Call
- func (mr *MockPostgreClientItfMockRecorder) GetReader(ctx interface{}) *gomock.Call
- func (mr *MockPostgreClientItfMockRecorder) GetWriter(ctx interface{}) *gomock.Call
- type PGXClient
- type PostgreClientItf
- type PostgreConfiguration
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.
func (*MockPostgreClientItfMockRecorder) GetReader ¶ added in v0.8.0
func (mr *MockPostgreClientItfMockRecorder) GetReader(ctx interface{}) *gomock.Call
GetReader indicates an expected call of GetReader.
func (*MockPostgreClientItfMockRecorder) GetWriter ¶ added in v0.8.0
func (mr *MockPostgreClientItfMockRecorder) GetWriter(ctx interface{}) *gomock.Call
GetWriter indicates an expected call of GetWriter.
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. First config parameter will always be used for writer. Second config and next will always be used for reader. If only one configuration is being passed, that configuration will be used for both writer and reader.
type PostgreClientItf ¶
type PostgreClientItf interface { // Get returns connection client to postgres. Get(ctx context.Context) (*pgxpool.Pool, error) // GetWriter returns connection client to postgres only for writing. GetWriter(ctx context.Context) (*pgxpool.Pool, error) // GetReader returns connection client to postgres only for reading. GetReader(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 }