mysql_batch

package
v1.0.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportSourceByPKRange

func ExportSourceByPKRange(ctx context.Context, db *sql.DB, cfg SourceConfig) ([]string, error)

ExportSourceByPKRange exports source rows into shard text files. Each output line format is: id\tbiz_key\tmetric

func ImportReduceOutputs

func ImportReduceOutputs(ctx context.Context, db *sql.DB, cfg SinkConfig) error

ImportReduceOutputs imports mr-out-* files into target table with batch upsert.

Types

type SinkAdapter

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

func NewSinkAdapter

func NewSinkAdapter(cfg SinkConfig) SinkAdapter

func (SinkAdapter) Import

func (a SinkAdapter) Import(ctx context.Context, db *sql.DB) error

func (SinkAdapter) InputGlob

func (a SinkAdapter) InputGlob() string

type SinkConfig

type SinkConfig struct {
	TargetTable string `json:"targettable"`
	KeyColumn   string `json:"keycolumn"`
	ValColumn   string `json:"valcolumn"`
	InputGlob   string `json:"inputglob"`
	Replace     bool   `json:"replace"`
	BatchSize   int    `json:"batchsize"`
}

SinkConfig configures reduce output import into MySQL.

func (*SinkConfig) WithDefaults

func (c *SinkConfig) WithDefaults()

type SourceAdapter

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

func NewSourceAdapter

func NewSourceAdapter(cfg SourceConfig) SourceAdapter

func (SourceAdapter) Export

func (a SourceAdapter) Export(ctx context.Context, db *sql.DB) ([]string, error)

type SourceConfig

type SourceConfig struct {
	Table      string `json:"table"`
	PKColumn   string `json:"pkcolumn"`
	KeyColumn  string `json:"keycolumn"`
	ValColumn  string `json:"valcolumn"`
	Where      string `json:"where"`
	Shards     int    `json:"shards"`
	Parallel   int    `json:"parallel"`
	OutputDir  string `json:"outputdir"`
	FilePrefix string `json:"fileprefix"`
}

SourceConfig configures source export from MySQL table to text shards.

func (*SourceConfig) WithDefaults

func (c *SourceConfig) WithDefaults()

Jump to

Keyboard shortcuts

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