config

package
v0.0.0-...-11f4c05 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnDef

type ColumnDef struct {
	Type     string  `yaml:"Type" validate:"required"`
	Nullable float64 `yaml:"Nullable" validate:"optional"`
	First    string  `yaml:"First" validate:"optional"`
	MinVal   string  `yaml:"MinVal" validate:"optional"`
	MaxVal   string  `yaml:"MaxVal" validate:"optional"`
	OneOf    string  `yaml:"OneOf" validate:"optional"`
	Length   int     `yaml:"Length" validate:"optional"`
	Format   string  `yaml:"Format" validate:"optional"`
}

ColumnDef defines the type of data we want inserted into a single column of a particular database table.

type RunArgs

type RunArgs struct {
	Database string `validate:"required"`
	Host     string `validate:"required"`
	Password string `validate:"required"`
	Port     string `validate:"required,number,gt=0"`
	Safe     bool
	Tables   []string `validate:"required,gt=0"`
	User     string   `validate:"required"`
}

RunArgs is a container for command-line flags passed in.

func (RunArgs) GetDSN

func (a RunArgs) GetDSN() string

type TableDef

type TableDef struct {
	TableName    string               `yaml:"TableName" validate:"required"`
	TotalRecords int                  `yaml:"TotalRecords" validate:"required,gt=0"`
	BatchSize    int                  `yaml:"BatchSize" validate:"required,gt=0"`
	SafeImport   bool                 // TODO: should this be global?
	Columns      map[string]ColumnDef `yaml:"Columns" validate:"required,dive,keys,required,endkeys"`
}

TableDef describes one particular database table. Its data is (mostly) loaded from a YAML file.

func LoadConfig

func LoadConfig(args RunArgs) (string, []*TableDef, error)

Jump to

Keyboard shortcuts

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