datastructure

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BOM = []byte{0xef, 0xbb, 0xbf} // UTF-8

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Region string           `json:"region"`
	Conf   []ValidationConf `json:"conf"`
}

func (*Conf) NewValidator

func (conf *Conf) NewValidator() *Validator

NewValidator is delegated to verify if the given configuration is valid, then initialize a new validator object.

This object will take in care the validation of the various dataset specified in configuration.

func (*Conf) Validate

func (conf *Conf) Validate()

type ErrorLine

type ErrorLine struct {
	Index     int    `json:"index,omitempty"`
	Row       string `json:"row,omitempty"`
	ErrorType string `json:"error_type,omitempty"`
	FieldName string `json:"field_name,omitempty"`
}

type ValidationConf

type ValidationConf struct {
	Path       []string          `json:"path"`
	Separator  string            `json:"separator"`
	DateFormat string            `json:"date_format"`
	Validation map[string]string `json:"validation"`
}

type Validator

type Validator struct {
	Conf      Conf
	S3session *s3.Client
}

func NewValidatorFromFile

func NewValidatorFromFile(cfg string) *Validator

func (*Validator) LoadFile

func (v *Validator) LoadFile(path string) (io.ReadCloser, error)

func (*Validator) ValidateData

func (v *Validator) ValidateData(csvHeaders []string, csvData [][]string, toValidate ValidationConf) ([]ErrorLine, error)

Jump to

Keyboard shortcuts

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