backfill

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPossible

func IsPossible(table *schema.Table) error

IsPossible will return an error if the backfill operation is not supported.

Types

type Backfill

type Backfill struct {
	// contains filtered or unexported fields
}

func New

func New(conn db.DB, opts ...OptionFn) *Backfill

New creates a new backfill operation with the given options. The backfill is not started until `Start` is invoked.

func (*Backfill) Start

func (bf *Backfill) Start(ctx context.Context, table *schema.Table) error

Start updates all rows in the given table, in batches, using the following algorithm: 1. Get the primary key column for the table. 2. Get the first batch of rows from the table, ordered by the primary key. 3. Update each row in the batch, setting the value of the primary key column to itself. 4. Repeat steps 2 and 3 until no more rows are returned.

type CallbackFn

type CallbackFn func(done int64, total int64)

type NotPossibleError

type NotPossibleError struct {
	Table string
}

func (NotPossibleError) Error

func (e NotPossibleError) Error() string

type OptionFn

type OptionFn func(*Backfill)

func WithBatchDelay

func WithBatchDelay(delay time.Duration) OptionFn

WithBatchDelay sets the delay between batches for the backfill operation.

func WithBatchSize

func WithBatchSize(batchSize int) OptionFn

WithBatchSize sets the batch size for the backfill operation.

func WithCallbacks

func WithCallbacks(cbs ...CallbackFn) OptionFn

WithCallbacks sets the callbacks for the backfill operation. Callbacks are invoked after each batch is processed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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