importer

package
v0.0.0-...-b3b47b0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2017 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDBs

func CloseDBs(dbs []*sql.DB)

Close DB connections

func CreateDBs

func CreateDBs(cfg DBConfig, count int) ([]*sql.DB, error)

Create DB connections

func DoProcess

func DoProcess(table *Table, dbs []*sql.DB, jobCount int, workerCount int, batch int)

Process populate data task

func ExecSQL

func ExecSQL(db *sql.DB, sql string) error

Execute SQL

func GenRowData

func GenRowData(table *Table) (string, error)

Generate row data

func ParseIndexSQL

func ParseIndexSQL(table *Table, sql string) error

Parse create index SQL

func ParseTableSQL

func ParseTableSQL(table *Table, sql string) error

Parse create table SQL

Types

type Config

type Config struct {
	// inherit from flag.FlagSet, ignore all the fields from parent
	*flag.FlagSet `json:"-"`

	TableSQL string `toml:"table-sql" json:"table-sql"`
	IndexSQL string `toml:"index-sql" json:"index-sql"`

	LogLevel string `toml:"log-level" json:"log-level"`

	WorkerCount int `toml:"worker-count" json:"worker-count"`
	JobCount    int `toml:"job-count" json:"job-count"`
	Batch       int `toml:"batch" json:"batch"`

	DBCfg DBConfig `toml:"db" json:"db"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig() *Config

Create a new config.

func (*Config) Parse

func (c *Config) Parse(arguments []string) error

Parse flag definitions from the argument list.

func (*Config) String

func (c *Config) String() string

type DBConfig

type DBConfig struct {
	Host     string `toml:"host" json:"host"`
	User     string `toml:"user" json:"user"`
	Password string `toml:"password" json:"password"`
	Name     string `toml:"name" json:"name"`
	Port     int    `toml:"port" json:"port"`
}

DB configuration.

func (*DBConfig) String

func (c *DBConfig) String() string

type Table

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

func NewTable

func NewTable() *Table

create table

Jump to

Keyboard shortcuts

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