mutator

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

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 NewOperation

func NewOperation(opts ...OperationOpt) *operation

func RegExpFromAttributeFormat

func RegExpFromAttributeFormat(attributeFormat string) *regexp.Regexp

func RegExpsFromAttributeFormat

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

func WithFuncPrefix

func WithFuncPrefix(fn func(string) string) func(o *operation)

func WithStringPrefix

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

Types

type Mutator

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

func (*Mutator) Child

func (m *Mutator) Child() *Mutator

func (*Mutator) IsArray

func (m *Mutator) IsArray() bool

func (*Mutator) ToArray

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

func (*Mutator) ToMap

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

type OperationOpt

type OperationOpt func(opt *operation)

type Parser

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

func (*Parser) Parse

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

Jump to

Keyboard shortcuts

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