Documentation ¶
Index ¶
- Constants
- Variables
- func Migrate(ctx context.Context, dbPool *pgxpool.Pool, dbParams params.Database, ...) error
- func RegisterMigrate(name string, f MigrateFunc, tables []string)
- func UnregisterAll()
- type Driver
- type EntriesIterator
- type MigrateFunc
- type Params
- type Store
- func (s *Store) Close()
- func (s *Store) Delete(ctx context.Context, partitionKey, key []byte) error
- func (s *Store) Get(ctx context.Context, partitionKey, key []byte) (*kv.ValueWithPredicate, error)
- func (s *Store) Scan(ctx context.Context, partitionKey, start []byte) (kv.EntriesIterator, error)
- func (s *Store) Set(ctx context.Context, partitionKey, key, value []byte) error
- func (s *Store) SetIf(ctx context.Context, partitionKey, key, value []byte, ...) error
Constants ¶
View Source
const ( DriverName = "postgres" DefaultTableName = "kv" // DefaultPartitions Changing the below value means repartitioning and probably a migration. // Change it only if you really know what you're doing. DefaultPartitions = 100 DefaultMaxOpenConnections = 25 DefaultMaxIdleConnections = 25 DefaultConnectionMaxLifetime = 5 * time.Minute DefaultScanPageSize = 1000 )
Variables ¶
View Source
var ( ErrAlreadyMigrated = errors.New("already migrated") ErrWrongDriverTypeMigration = errors.New("trying to migrate to non Postgres DB isn't supported") )
Functions ¶
func Migrate ¶ added in v0.66.0
func Migrate(ctx context.Context, dbPool *pgxpool.Pool, dbParams params.Database, blockParams blockparams.AdapterConfig, postgresParams *kvparams.Postgres) error
Migrate data migration from DB to KV
func RegisterMigrate ¶ added in v0.66.0
func RegisterMigrate(name string, f MigrateFunc, tables []string)
func UnregisterAll ¶ added in v0.66.0
func UnregisterAll()
UnregisterAll remove all loaded migrate callbacks, used for test code.
Types ¶
type EntriesIterator ¶
type EntriesIterator struct {
// contains filtered or unexported fields
}
func (*EntriesIterator) Close ¶
func (e *EntriesIterator) Close()
func (*EntriesIterator) Entry ¶
func (e *EntriesIterator) Entry() *kv.Entry
func (*EntriesIterator) Err ¶
func (e *EntriesIterator) Err() error
Err return the last scan error or the cursor error
type MigrateFunc ¶ added in v0.66.0
type MigrateFunc func(ctx context.Context, db *pgxpool.Pool, c blockparams.AdapterConfig, writer io.Writer) error
Click to show internal directories.
Click to hide internal directories.