shardedpg

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongShardsPoolSize     = errors.New("sharded pg: wrong shards pool size")
	ErrNoShardPickerProvided   = errors.New("sharded pg: no sharded picker provided")
	ErrNotEnoughShardsProvided = errors.New("sharded pg: provided less shards than pool size")
	ErrNilShardProvided        = errors.New("sharded pg: nil shard provided")
)

Functions

This section is empty.

Types

type Builder

type Builder interface {
	Picker(pickFn ShardPicker) Builder
	Shard(key uint, shard Pool) Builder
	Go() (*sharded.Hive, error)
}

func New

func New(poolSize uint) Builder

type Pool

type Pool interface {
	BeginTx(ctx context.Context, opts pgx.TxOptions) (pgx.Tx, error)
	Begin(ctx context.Context) (pgx.Tx, error)
	Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, query string, args ...interface{}) pgx.Row
	Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
	Transactional(ctx context.Context, fn func(ctx context.Context) error) (out error)
}

type ShardPicker

type ShardPicker func(ctx context.Context, key string) uint

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL