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 DBReaderWriter ¶
DBReaderWriter wraps db reader and writer
func NewDbConnection ¶
func NewDbConnection(ctx context.Context, ready *bool, ro ConnectOptions, wo ConnectOptions) *DBReaderWriter
NewDbConnection connects to the reader and writer per passed in options, with retries, returning a DBReaderWriter object that contains sql.DB connection
func (*DBReaderWriter) GetReaderConn ¶
func (dbs *DBReaderWriter) GetReaderConn() *sql.DB
GetReaderConn returns connection to reader
func (*DBReaderWriter) GetWriterConn ¶
func (dbs *DBReaderWriter) GetWriterConn() *sql.DB
GetWriterConn returns connection to writer
type DbStore ¶
type DbStore struct {
// contains filtered or unexported fields
}
DbStore holds the database connection and other stuff.
func NewDbConnectionFromSettings ¶
NewDbConnectionFromSettings sets up a db connection from the settings, only once
func (*DbStore) DBS ¶
func (store *DbStore) DBS() *DBReaderWriter
DBS returns the reader and writer databases to connect to
Click to show internal directories.
Click to hide internal directories.