model

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVFile

type CSVFile struct {
	Name          string
	Header        []string
	Lines         [][]string
	UniqueColumns []string
	Output        bool
}

CSVFile represents the content of a CSV file.

func (*CSVFile) Unique

func (c *CSVFile) Unique() [][]string

Unique removes any duplicates from the CSVFile's lines.

type Column

type Column struct {
	Name      string     `yaml:"name"`
	Type      string     `yaml:"type"`
	Suppress  bool       `yaml:"suppress"`
	Generator RawMessage `yaml:"processor"`
}

Column represents the instructions to populate one CSV file column.

type Config

type Config struct {
	Tables []Table `yaml:"tables"`
	Inputs []Input `yaml:"inputs"`
}

Config represents the entire contents of a config file.

func LoadConfig

func LoadConfig(r io.Reader) (Config, error)

Load config from a file

type Input

type Input struct {
	Name   string     `yaml:"name"`
	Type   string     `yaml:"type"`
	Source RawMessage `yaml:"source"`
}

Input represents a data source provided by the user.

type RawMessage

type RawMessage struct {
	UnmarshalFunc func(interface{}) error
}

RawMessage does what json.RawMessage does but for YAML.

func ToRawMessage

func ToRawMessage(t *testing.T, v any) RawMessage

ToRawMessage converts an object into a model.RawMessage for testing purposes.

func (*RawMessage) UnmarshalYAML

func (msg *RawMessage) UnmarshalYAML(unmarshal func(interface{}) error) error

type SourceCSV

type SourceCSV struct {
	FileName string `yaml:"file_name"`
}

SourceCSV represents a CSV file source.

type Table

type Table struct {
	Name          string   `yaml:"name"`
	Count         int      `yaml:"count"`
	Suppress      bool     `yaml:"suppress"`
	UniqueColumns []string `yaml:"unique_columns"`
	Columns       []Column `yaml:"columns"`
}

Table represents the instructions to create one CSV file.

Jump to

Keyboard shortcuts

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