internal

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YAML outputFormat = iota
	JSON
)
View Source
const (
	DefAttributeNameFormat = `("[A-Za-z_]+[A-Za-z0-9_./-]*"|[A-Za-z_]+[A-Za-z0-9_/-]*)`
)

Variables

This section is empty.

Functions

func RegExpFromAttributeFormat

func RegExpFromAttributeFormat(attributeFormat string) *regexp.Regexp

func RegExpsFromAttributeFormat added in v0.0.5

func RegExpsFromAttributeFormat(attributeFormat string) (*regexp.Regexp, *regexp.Regexp)

func WithFuncPrefix added in v0.0.7

func WithFuncPrefix(fn func(string) string) func(setter *Setter)

func WithOutputFormat

func WithOutputFormat(fmt outputFormat) func(output *Outputter)

func WithStringPrefix added in v0.0.7

func WithStringPrefix(prefix string) func(setter *Setter)

Types

type Mutator

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

func (*Mutator) Child

func (m *Mutator) Child() *Mutator

func (*Mutator) String

func (m *Mutator) String() string

func (*Mutator) ToArray

func (m *Mutator) ToArray(content []any) []any

func (*Mutator) ToMap

func (m *Mutator) ToMap(content map[string]any) map[string]any

func (*Mutator) WithValue

func (m *Mutator) WithValue(value any)

type OutputOpt

type OutputOpt func(output *Outputter)

type Outputter

type Outputter struct {
	Fmt outputFormat
}

func NewOutput

func NewOutput(options ...OutputOpt) *Outputter

func (*Outputter) JSON

func (o *Outputter) JSON(content any) string

func (*Outputter) String

func (o *Outputter) String(content any) string

func (*Outputter) YAML

func (o *Outputter) YAML(content any) string

type Parser

type Parser struct {
	RegExp          *regexp.Regexp
	AttributeRegExp *regexp.Regexp
	Strict          bool
}

func (*Parser) Parse

func (p *Parser) Parse(pathExpr string) *Mutator

type PathValue

type PathValue struct {
	Path  string
	Value any
}

type PathValueList

type PathValueList []PathValue

type Sanitizer

type Sanitizer struct {
	Strict bool
}

func (*Sanitizer) SanitizePathValueList

func (s *Sanitizer) SanitizePathValueList(args ...any) PathValueList

type Setter added in v0.0.7

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

func NewSetter added in v0.0.7

func NewSetter(opts ...SetterOpt) *Setter

func (*Setter) Set added in v0.0.7

func (s *Setter) Set(parser *Parser, pathValueList PathValueList) (mutators []Mutator)

type SetterOpt added in v0.0.7

type SetterOpt func(setter *Setter)

Jump to

Keyboard shortcuts

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