Documentation ¶
Index ¶
- func Scan[T any](rows Rows, pointers func(*T) []interface{}) ([]T, error)
- type ConnOpener
- type DB
- func (db *DB[T]) Close()
- func (db *DB[T]) WaitForConn(ctx context.Context, criteria cluster.NodeStateCriteria) (T, error)
- func (db *DB[T]) WaitForDefaultConn(ctx context.Context) (T, error)
- func (db *DB[T]) WaitForReadFromConn(ctx context.Context) (T, error)
- func (db *DB[T]) WaitForWriteToConn(ctx context.Context) (T, error)
- type DBxer
- type Option
- func WithClusterOptions[T any](options ...cluster.ClusterOption[T]) Option[T]
- func WithCtx[T any](ctx context.Context) Option[T]
- func WithDefaultNode[T any](criteria cluster.NodeStateCriteria) Option[T]
- func WithNodeWaitTimeout[T any](timeout time.Duration) Option[T]
- func WithReadFromNode[T any](criteria cluster.NodeStateCriteria) Option[T]
- func WithWriteToNode[T any](criteria cluster.NodeStateCriteria) Option[T]
- type Row
- type Rows
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnOpener ¶
type DB ¶
type DB[T any] struct { Cluster *cluster.Cluster[T] NodeWaitTimeout time.Duration WriteToNode cluster.NodeStateCriteria // This is used, when we can clearly guess, that query is a write query (for example, Exec()) ReadFromNode cluster.NodeStateCriteria // This is used, when we can clearly guess, that query is a read query (for example, Query()) DefaultNode cluster.NodeStateCriteria // This is used, when we can not figure out, what type of request is formed (like Prepare()) Ctx context.Context // contains filtered or unexported fields }
func NewDB ¶
func NewDB[T any](driverName string, dsns []string, connOpener ConnOpener[T], connCloser cluster.ConnCloser[T], nodeChecker cluster.NodeChecker[T], options ...Option[T]) (*DB[T], error)
func (*DB[T]) WaitForConn ¶
func (*DB[T]) WaitForDefaultConn ¶
func (*DB[T]) WaitForReadFromConn ¶
type DBxer ¶
type DBxer[TConn any, TTx any, TTxOptions any] interface { DoTx(f func(db DBxer[TConn, TTx, TTxOptions]) error, opts TTxOptions) error DoTxContext( ctx context.Context, f func(ctx context.Context, db DBxer[TConn, TTx, TTxOptions]) error, opts TTxOptions) error Tx() (TTx, error) WaitForConn(ctx context.Context, criteria cluster.NodeStateCriteria) (TConn, error) WaitForWriteToConn(ctx context.Context) (TConn, error) WaitForReadFromConn(ctx context.Context) (TConn, error) WaitForDefaultConn(ctx context.Context) (TConn, error) }
type Option ¶
func WithClusterOptions ¶
func WithClusterOptions[T any](options ...cluster.ClusterOption[T]) Option[T]
func WithDefaultNode ¶
func WithDefaultNode[T any](criteria cluster.NodeStateCriteria) Option[T]
func WithReadFromNode ¶
func WithReadFromNode[T any](criteria cluster.NodeStateCriteria) Option[T]
func WithWriteToNode ¶
func WithWriteToNode[T any](criteria cluster.NodeStateCriteria) Option[T]
Click to show internal directories.
Click to hide internal directories.