load

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchLoader

type BatchLoader interface {
	InsertValue(ctx context.Context, query []string) error
	Flush(ctx context.Context) error
}

type CSVBatchLoader

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

CSVBatchLoader helps us insert in batch

func NewCSVBatchLoader

func NewCSVBatchLoader(f *os.File) *CSVBatchLoader

NewCSVBatchLoader creates a batch loader for csv format

func (*CSVBatchLoader) Close

func (b *CSVBatchLoader) Close(ctx context.Context) error

Close closes the file.

func (*CSVBatchLoader) Flush

func (b *CSVBatchLoader) Flush(ctx context.Context) error

Flush inserts all pending values

func (*CSVBatchLoader) InsertValue

func (b *CSVBatchLoader) InsertValue(ctx context.Context, columns []string) error

InsertValue inserts a value, the loader may flush all pending values.

type SQLBatchLoader

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

SQLBatchLoader helps us insert in batch

func NewSQLBatchLoader

func NewSQLBatchLoader(db *sql.DB, hint string, retryCount int, retryInterval time.Duration) *SQLBatchLoader

NewSQLBatchLoader creates a batch loader for database connection

func (*SQLBatchLoader) Flush

func (b *SQLBatchLoader) Flush(ctx context.Context) error

Flush inserts all pending values

func (*SQLBatchLoader) InsertValue

func (b *SQLBatchLoader) InsertValue(ctx context.Context, query []string) error

InsertValue inserts a value, the loader may flush all pending values.

Jump to

Keyboard shortcuts

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