csv

package
v0.55.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DEFAULTSEPARATOR defines the default csv separator
	DEFAULTSEPARATOR rune = ','
	// DEFAULTCOMMENT defines the default comment character
	DEFAULTCOMMENT rune = '#'
)

Variables

View Source
var (
	ErrSpecFileUndefined       = errors.New("csv file undefined")
	ErrSpecKeyUndefined        = errors.New("csv key or query undefined")
	ErrSpecFileAndFilesDefined = errors.New("parameter \"file\" and \"files\" are mutually exclusive")
	// ErrWrongSpec is returned when the Spec has wrong content
	ErrWrongSpec error = errors.New("wrong spec content")
)
View Source
var (
	// ErrDaselFailedParsingJSONByteFormat is returned if dasel couldn't parse the byteData
	ErrDaselFailedParsingJSONByteFormat error = errors.New("fail to parse Json data")
)
View Source
var (
	ErrSpecVersionFilterRequireMultiple = errors.New("in the context of a source, parameter \"versionfilter\" and \"query\" must be used together")
)

Functions

This section is empty.

Types

type CSV

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

CSV stores configuration about the file and the key value which needs to be updated.

func New

func New(spec interface{}) (*CSV, error)

func (*CSV) Changelog

func (c *CSV) Changelog() string

Changelog returns the changelog for this resource, or an empty string if not supported

func (*CSV) Condition

func (c *CSV) Condition(source string, scm scm.ScmHandler, resultCondition *result.Condition) error

func (*CSV) Source

func (c *CSV) Source(workingDir string, resultSource *result.Source) error

func (*CSV) Target

func (c *CSV) Target(source string, scm scm.ScmHandler, dryRun bool, resultTarget *result.Target) error

Target updates a scm repository based on the modified yaml file.

type Spec

type Spec struct {
	// [s][c][t] File specifies the csv file
	File string `yaml:",omitempty"`
	// [c][t] Files specifies a list of Json file to manipulate
	Files []string `yaml:",omitempty"`
	// [s][c][t] Key specifies the csv query
	Key string `yaml:",omitempty"`
	// [s][c][t] Query allows to used advanced query. Override the parameter key
	Query string `yaml:",omitempty"`
	// [s][c][t] Key specifies the csv value, default to source output
	Value string `yaml:",omitempty"`
	// [s][c][t] Comma specifies the csv separator character, default ","
	Comma rune `yaml:",omitempty"`
	// [s][c][t] Comma specifies the csv comment character, default "#"
	Comment rune `yaml:",omitempty"`
	// [c][t] *Deprecated* Please look at query parameter to achieve similar objective
	Multiple bool `yaml:",omitempty" jsonschema:"-"`
	// [s]VersionFilter provides parameters to specify version pattern and its type like regex, semver, or just latest.
	VersionFilter version.Filter `yaml:",omitempty"`
}

func (*Spec) Validate

func (s *Spec) Validate() error

Jump to

Keyboard shortcuts

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