Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
Datastore is a concrete implementation for a database
func NewDatastore ¶ added in v0.13.0
func (*Datastore) BeginTx ¶
BeginTx is a wrapper for sql.DB.BeginTx in order to expose from the Datastore interface
type Datastorer ¶ added in v0.15.0
type Datastorer interface {
DB() *sql.DB
BeginTx(context.Context) (*sql.Tx, error)
RollbackTx(*sql.Tx, error) error
CommitTx(*sql.Tx) error
}
Datastorer is an interface for working with the Database
type MockDatastore ¶
type MockDatastore struct {
}
MockDatastore is a mock implementation for a database
func NewMockDatastore ¶ added in v0.15.0
func NewMockDatastore() *MockDatastore
func (*MockDatastore) BeginTx ¶ added in v0.15.0
BeginTx is a wrapper for sql.DB.BeginTx in order to expose from the Datastore interface
func (*MockDatastore) CommitTx ¶ added in v0.15.0
func (mds *MockDatastore) CommitTx(_ *sql.Tx) error
CommitTx is a wrapper for sql.Tx.Commit in order to expose from the Datastore interface. Proper error handling is also considered.
func (*MockDatastore) DB ¶ added in v0.16.0
func (mds *MockDatastore) DB() *sql.DB
func (*MockDatastore) RollbackTx ¶ added in v0.15.0
func (mds *MockDatastore) RollbackTx(_ *sql.Tx, err error) error
RollbackTx is a wrapper for sql.Tx.Rollback in order to expose from the Datastore interface. Proper error handling is also considered.
type Name ¶ added in v0.15.0
type Name int
DSName defines the name for the Datastore
const ( // LocalDatastore represents the local PostgreSQL db LocalDatastore Name = iota // GCPCPDatastore represents a local connection to a GCP Cloud // SQL db through the Google Cloud Proxy GCPCPDatastore // GCPDatastore represents a true GCP connection to a GCP // Cloud SQL db GCPDatastore // MockedDatastore represents a Mocked Database MockedDatastore )
Click to show internal directories.
Click to hide internal directories.