Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectOptions ¶
type ConnectOptions struct {
DSN string
DriverName string
Retries int
RetryDelay time.Duration
ConnectTimeout time.Duration
ConnMaxLifetime time.Duration
MaxIdleConnections int
MaxOpenConnections int
}
ConnectOptions config options for database
type ReaderWriter ¶ added in v0.1.2
ReaderWriter wraps db reader and writer
func NewDbConnection ¶
func NewDbConnection(ctx context.Context, ready *bool, ro ConnectOptions, wo ConnectOptions) *ReaderWriter
NewDbConnection connects to the reader and writer per passed in options, with retries, returning a DBReaderWriter object that contains sql.DB connection
func (*ReaderWriter) GetReaderConn ¶ added in v0.1.2
func (dbs *ReaderWriter) GetReaderConn() *sql.DB
GetReaderConn returns connection to reader
func (*ReaderWriter) GetWriterConn ¶ added in v0.1.2
func (dbs *ReaderWriter) GetWriterConn() *sql.DB
GetWriterConn returns connection to writer
type Store ¶ added in v0.1.2
type Store struct {
// contains filtered or unexported fields
}
Store holds the database connection and other stuff.
func NewDbConnectionForTest ¶
func NewDbConnectionForTest(ctx context.Context, settings config.Settings, withSearchPath bool) Store
NewDbConnectionForTest use this for tests as we have multiple sessions in parallel and don't want synced one
func NewDbConnectionFromSettings ¶
func NewDbConnectionFromSettings(ctx context.Context, settings *config.Settings, withSearchPath bool) Store
NewDbConnectionFromSettings sets up a db connection from the settings, only once
func (*Store) DBS ¶ added in v0.1.2
func (store *Store) DBS() *ReaderWriter
DBS returns the reader and writer databases to connect to
Click to show internal directories.
Click to hide internal directories.