Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFromConfigs ¶
NewFromConfigs concurrently opens each underlying physical db. first being used as the primary and the rest as replica.
Types ¶
type Conn ¶
type Conn interface { Select(ctx context.Context, dst interface{}, sql string, args ...interface{}) error Get(ctx context.Context, dst interface{}, sql string, args ...interface{}) error Exec(ctx context.Context, sql string, args ...interface{}) (int64, error) Tx(ctx context.Context, f func(n conn.Querier) error, opts ...conn.TxOption) error Primary() conn.Querier Replica() conn.Querier Ping(context.Context) error Close() error }
Conn is a logical database with multiple underlying physical databases forming a single primary multiple replica topology. Reads(Get, Select) and writes(Exec, Tx) are automatically directed to the correct physical db.
type Option ¶
type Option func(*Options)
Option func.
func WithConnPicker ¶
func WithConnPicker(picker ConnPicker) Option
WithConnPicker sets connection picker for Select and Get
Click to show internal directories.
Click to hide internal directories.