microbatch

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Insert

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

Insert creates batches limited by the configured batch size.

func NewInsert

func NewInsert(tx pgx.Tx, batchSize int, timeout time.Duration) *Insert

NewInsert returns a new micro batcher for inserting vulnerabilities to the database.

func (*Insert) Done

func (v *Insert) Done(ctx context.Context) error

Done submits any existing queued inserts.

Done MUST be called once the caller has queued all vulnerabilities to ensure the batches are properly flushed.

func (*Insert) Queue

func (v *Insert) Queue(ctx context.Context, query string, args ...interface{}) error

Queue enqueues a query and its arguments into a batch.

When Queue is called all queued inserts may be sent if the configured batch size is reached.

Jump to

Keyboard shortcuts

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