generator

package
v0.0.0-...-1494de3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddInput

func AddInput(table, column string, line []string, files map[string]model.CSVFile)

AddInput adds a column to a table in the given files map.

func AddTable

func AddTable(table model.Table, column string, line []string, files map[string]model.CSVFile)

AddTable adds a column to a table in the given files map.

func CartesianProduct

func CartesianProduct(a ...[]string) [][]string

CartesianProduct returns the Cartesian product of a variable number of arrays.

func Transpose

func Transpose(m [][]string) [][]string

Transpose a multi-dimensional array.

Types

type ConstGenerator

type ConstGenerator struct {
	Values []string `yaml:"values"`
}

ConstGenerator provides additional context to a const column.

func (ConstGenerator) Generate

func (g ConstGenerator) Generate(t model.Table, files map[string]model.CSVFile) error

Generate values for a column based on a series of provided values.

type EachGenerator

type EachGenerator struct {
	Table  string `yaml:"table"`
	Column string `yaml:"column"`
}

EachGenerator provides additional context to an each or ref column.

func (EachGenerator) Generate

func (g EachGenerator) Generate(t model.Table, files map[string]model.CSVFile) error

Generate looks for any each type columns for a table, and returns their Cartesian product back into the given files map.

type Formatter

type Formatter interface {
	Format(string) string
}

Formatter determines the behaviour for anything that can take a format string and return another.

type FormatterProcessor

type FormatterProcessor interface {
	GetFormat() string
}

FormatterProcessor can be called to get the Format string out of a struct that implements this interface.

type GenGenerator

type GenGenerator struct {
	Value          string `yaml:"value"`
	NullPercentage int    `yaml:"null_percentage"`
	Format         string `yaml:"format"`
}

GenGenerator provides additional context to a gen column.

func (GenGenerator) Generate

func (g GenGenerator) Generate(t model.Table, c model.Column, files map[string]model.CSVFile) error

Generate random data for a given column.

func (GenGenerator) GetFormat

func (g GenGenerator) GetFormat() string

type IncGenerator

type IncGenerator struct {
	Start  int    `yaml:"start"`
	Format string `yaml:"format"`
}

IncGenerator provides additional context to an inc column.

func (IncGenerator) Generate

func (g IncGenerator) Generate(t model.Table, c model.Column, files map[string]model.CSVFile) error

Generate an incrementing number value for a column.

func (IncGenerator) GetFormat

func (pi IncGenerator) GetFormat() string

type MatchGenerator

type MatchGenerator struct {
	SourceTable  string `yaml:"source_table"`
	SourceColumn string `yaml:"source_column"`
	SourceValue  string `yaml:"source_value"`
	MatchColumn  string `yaml:"match_column"`
}

MatchGenerator provides additional context to a match column.

func (MatchGenerator) Generate

func (g MatchGenerator) Generate(t model.Table, c model.Column, files map[string]model.CSVFile) error

Generate matches values from a previously generated table and inserts values into a new table where match is found.

type RangeGenerator

type RangeGenerator struct {
	Type   string `yaml:"type"`
	From   string `yaml:"from"`
	To     string `yaml:"to"`
	Step   string `yaml:"step"`
	Format string `yaml:"format"`
}

RangeGenerator provides additional context to a range column.

func (RangeGenerator) Generate

func (g RangeGenerator) Generate(t model.Table, c model.Column, files map[string]model.CSVFile) error

Generate sequential data between a given start and end range.

type RefGenerator

type RefGenerator struct {
	Table  string `yaml:"table"`
	Column string `yaml:"column"`
}

RefGenerator provides additional context to a ref column.

func (RefGenerator) Generate

func (g RefGenerator) Generate(t model.Table, c model.Column, files map[string]model.CSVFile) error

Generate looks to previously generated table data and references that when generating data for the given table.

type SetGenerator

type SetGenerator struct {
	Values  []string `yaml:"values"`
	Weights []int    `yaml:"weights"`
}

SetGenerator provides additional context to a set column.

func (SetGenerator) Generate

func (g SetGenerator) Generate(t model.Table, c model.Column, files map[string]model.CSVFile) error

Generate selects between a set of values for a given table.

Jump to

Keyboard shortcuts

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