Documentation
¶
Overview ¶
Use the top level Evaluator or StreamEvaluator to evaluate expressions and return matches.
Index ¶
- Variables
- func FormatStringFromFilename(filename string) string
- func GetAvailableInputFormatString() string
- func GetAvailableOutputFormatString() string
- func GetLogger() *logging.Logger
- func InitExpressionParser()
- func KindString(kind Kind) string
- func MapToYamlStyle(original Style) yaml.Style
- func NewFrontMatterHandler(originalFilename string) frontMatterHandler
- func NewWriteInPlaceHandler(inputFile string) writeInPlaceHandler
- func NodeContentToString(node *CandidateNode, depth int) string
- func NodeToString(node *CandidateNode) string
- func NodesToString(collection *list.List) string
- func ReadDocuments(reader io.Reader, decoder Decoder) (*list.List, error)
- func SafelyCloseReader(reader io.Reader)
- type CandidateNode
- func (n *CandidateNode) AddChild(rawChild *CandidateNode)
- func (n *CandidateNode) AddChildren(children []*CandidateNode)
- func (n *CandidateNode) AddKeyValueChild(rawKey *CandidateNode, rawValue *CandidateNode) (*CandidateNode, *CandidateNode)
- func (n *CandidateNode) AsList() *list.List
- func (n *CandidateNode) CanVisitValues() bool
- func (n *CandidateNode) ConvertToNodeInfo() *NodeInfo
- func (n *CandidateNode) Copy() *CandidateNode
- func (n *CandidateNode) CopyAsReplacement(replacement *CandidateNode) *CandidateNode
- func (n *CandidateNode) CopyWithoutContent() *CandidateNode
- func (n *CandidateNode) CreateChild() *CandidateNode
- func (n *CandidateNode) CreateReplacement(kind Kind, tag string, value string) *CandidateNode
- func (n *CandidateNode) CreateReplacementWithComments(kind Kind, tag string, style Style) *CandidateNode
- func (n *CandidateNode) FilterMapContentByKey(keyPredicate func(*CandidateNode) bool) []*CandidateNode
- func (n *CandidateNode) GetDocument() uint
- func (n *CandidateNode) GetFileIndex() int
- func (n *CandidateNode) GetFilename() string
- func (n *CandidateNode) GetKey() string
- func (n *CandidateNode) GetNicePath() string
- func (n *CandidateNode) GetPath() []interface{}
- func (n *CandidateNode) GetValueRep() (interface{}, error)
- func (o *CandidateNode) MarshalJSON() ([]byte, error)
- func (o *CandidateNode) MarshalYAML() (*yaml.Node, error)
- func (n *CandidateNode) SetDocument(idx uint)
- func (n *CandidateNode) SetFileIndex(idx int)
- func (n *CandidateNode) SetFilename(name string)
- func (n *CandidateNode) SetParent(parent *CandidateNode)
- func (o *CandidateNode) UnmarshalGoccyYAML(node ast.Node, cm yaml.CommentMap, anchorMap map[string]*CandidateNode) error
- func (o *CandidateNode) UnmarshalJSON(data []byte) error
- func (o *CandidateNode) UnmarshalYAML(node *yaml.Node, anchorMap map[string]*CandidateNode) error
- func (n *CandidateNode) UpdateAttributesFrom(other *CandidateNode, prefs assignPreferences)
- func (n *CandidateNode) UpdateFrom(other *CandidateNode, prefs assignPreferences)
- func (n *CandidateNode) VisitValues(visitor ValueVisitor) error
- type Context
- func (n *Context) ChildContext(results *list.List) Context
- func (n *Context) Clone() Context
- func (n *Context) DeepClone() Context
- func (n *Context) GetDateTimeLayout() string
- func (n *Context) GetVariable(name string) *list.List
- func (n *Context) ReadOnlyClone() Context
- func (n *Context) SetDateTimeLayout(newDateTimeLayout string)
- func (n *Context) SetVariable(name string, value *list.List)
- func (n *Context) SingleChildContext(candidate *CandidateNode) Context
- func (n *Context) SingleReadonlyChildContext(candidate *CandidateNode) Context
- func (n *Context) ToString() string
- func (n *Context) WritableClone() Context
- type CsvPreferences
- type DataTreeNavigator
- type Decoder
- func NewBase64Decoder() Decoder
- func NewCSVObjectDecoder(prefs CsvPreferences) Decoder
- func NewGoccyYAMLDecoder() Decoder
- func NewHclDecoder() Decoder
- func NewINIDecoder() Decoder
- func NewJSONDecoder() Decoder
- func NewLuaDecoder(prefs LuaPreferences) Decoder
- func NewPropertiesDecoder() Decoder
- func NewTomlDecoder() Decoder
- func NewUriDecoder() Decoder
- func NewXMLDecoder(prefs XmlPreferences) Decoder
- func NewYamlDecoder(prefs YamlPreferences) Decoder
- type DecoderFactoryFunction
- type Encoder
- func NewBase64Encoder() Encoder
- func NewCsvEncoder(prefs CsvPreferences) Encoder
- func NewHclEncoder(prefs HclPreferences) Encoder
- func NewINIEncoder() Encoder
- func NewJSONEncoder(prefs JsonPreferences) Encoder
- func NewLuaEncoder(prefs LuaPreferences) Encoder
- func NewPropertiesEncoder(prefs PropertiesPreferences) Encoder
- func NewShEncoder() Encoder
- func NewShellVariablesEncoder() Encoder
- func NewTomlEncoder() Encoder
- func NewUriEncoder() Encoder
- func NewXMLEncoder(prefs XmlPreferences) Encoder
- func NewYamlEncoder(prefs YamlPreferences) Encoder
- type EncoderFactoryFunction
- type Evaluator
- type ExpressionNode
- type ExpressionParserInterface
- type Format
- type HclPreferences
- type INIPreferences
- type JsonPreferences
- type Kind
- type LuaPreferences
- type NodeInfo
- type Operation
- type Printer
- type PrinterWriter
- type PropertiesPreferences
- type SecurityPreferences
- type ShellVariablesPreferences
- type StreamEvaluator
- type StringEvaluator
- type Style
- type ValueVisitor
- type XmlPreferences
- type YamlPreferences
Constants ¶
This section is empty.
Variables ¶
View Source
var Base64Format = &Format{"base64", []string{}, func() Encoder { return NewBase64Encoder() }, func() Decoder { return NewBase64Decoder() }, }
View Source
var CSVFormat = &Format{"csv", []string{"c"}, func() Encoder { return NewCsvEncoder(ConfiguredCsvPreferences) }, func() Decoder { return NewCSVObjectDecoder(ConfiguredCsvPreferences) }, }
View Source
var ConfiguredCsvPreferences = NewDefaultCsvPreferences()
View Source
var ConfiguredHclPreferences = NewDefaultHclPreferences()
View Source
var ConfiguredINIPreferences = NewDefaultINIPreferences()
View Source
var ConfiguredJSONPreferences = NewDefaultJsonPreferences()
View Source
var ConfiguredLuaPreferences = NewDefaultLuaPreferences()
View Source
var ConfiguredPropertiesPreferences = NewDefaultPropertiesPreferences()
View Source
var ConfiguredSecurityPreferences = SecurityPreferences{ DisableEnvOps: false, DisableFileOps: false, }
View Source
var ConfiguredShellVariablesPreferences = NewDefaultShellVariablesPreferences()
View Source
var ConfiguredTsvPreferences = NewDefaultTsvPreferences()
View Source
var ConfiguredXMLPreferences = NewDefaultXmlPreferences()
View Source
var ConfiguredYamlPreferences = NewDefaultYamlPreferences()
View Source
var Formats = []*Format{ YamlFormat, JSONFormat, PropertiesFormat, CSVFormat, TSVFormat, XMLFormat, Base64Format, UriFormat, ShFormat, TomlFormat, HclFormat, ShellVariablesFormat, LuaFormat, INIFormat, }
View Source
var HclFormat = &Format{"hcl", []string{"h"}, func() Encoder { return NewHclEncoder(ConfiguredHclPreferences) }, func() Decoder { return NewHclDecoder() }, }
View Source
var INIFormat = &Format{"ini", []string{"i"}, func() Encoder { return NewINIEncoder() }, func() Decoder { return NewINIDecoder() }, }
View Source
var JSONFormat = &Format{"json", []string{"j"}, func() Encoder { return NewJSONEncoder(ConfiguredJSONPreferences) }, func() Decoder { return NewJSONDecoder() }, }
View Source
var LoadYamlPreferences = YamlPreferences{ LeadingContentPreProcessing: false, PrintDocSeparators: true, UnwrapScalar: true, EvaluateTogether: false, }
View Source
var LuaFormat = &Format{"lua", []string{"l"}, func() Encoder { return NewLuaEncoder(ConfiguredLuaPreferences) }, func() Decoder { return NewLuaDecoder(ConfiguredLuaPreferences) }, }
View Source
var Now = time.Now
for unit tests
View Source
var PrettyPrintExp = `(... | (select(tag != "!!str"), select(tag == "!!str") | select(test("(?i)^(y|yes|n|no|on|off)$") | not)) ) style=""`
View Source
var PropertiesFormat = &Format{"props", []string{"p", "properties"}, func() Encoder { return NewPropertiesEncoder(ConfiguredPropertiesPreferences) }, func() Decoder { return NewPropertiesDecoder() }, }
View Source
var ShFormat = &Format{"", nil, func() Encoder { return NewShEncoder() }, nil, }
View Source
var ShellVariablesFormat = &Format{"shell", []string{"s", "sh"}, func() Encoder { return NewShellVariablesEncoder() }, nil, }
View Source
var StringInterpolationEnabled = true
View Source
var TSVFormat = &Format{"tsv", []string{"t"}, func() Encoder { return NewCsvEncoder(ConfiguredTsvPreferences) }, func() Decoder { return NewCSVObjectDecoder(ConfiguredTsvPreferences) }, }
View Source
var TomlFormat = &Format{"toml", []string{}, func() Encoder { return NewTomlEncoder() }, func() Decoder { return NewTomlDecoder() }, }
View Source
var UriFormat = &Format{"uri", []string{}, func() Encoder { return NewUriEncoder() }, func() Decoder { return NewUriDecoder() }, }
View Source
var XMLFormat = &Format{"xml", []string{"x"}, func() Encoder { return NewXMLEncoder(ConfiguredXMLPreferences) }, func() Decoder { return NewXMLDecoder(ConfiguredXMLPreferences) }, }
View Source
var YamlFormat = &Format{"yaml", []string{"y", "yml"}, func() Encoder { return NewYamlEncoder(ConfiguredYamlPreferences) }, func() Decoder { return NewYamlDecoder(ConfiguredYamlPreferences) }, }
Functions ¶
func FormatStringFromFilename ¶ added in v4.42.1
func GetAvailableInputFormatString ¶ added in v4.42.1
func GetAvailableInputFormatString() string
func GetAvailableOutputFormatString ¶ added in v4.42.1
func GetAvailableOutputFormatString() string
func InitExpressionParser ¶ added in v4.19.1
func InitExpressionParser()
func KindString ¶
func MapToYamlStyle ¶ added in v4.40.1
func NewFrontMatterHandler ¶ added in v4.11.0
func NewFrontMatterHandler(originalFilename string) frontMatterHandler
func NewWriteInPlaceHandler ¶
func NewWriteInPlaceHandler(inputFile string) writeInPlaceHandler
func NodeContentToString ¶ added in v4.40.1
func NodeContentToString(node *CandidateNode, depth int) string
func NodeToString ¶
func NodeToString(node *CandidateNode) string
func ReadDocuments ¶ added in v4.43.1
func SafelyCloseReader ¶ added in v4.11.0
Types ¶
type CandidateNode ¶
type CandidateNode struct {
Kind Kind
Style Style
Tag string
Value string
Anchor string
Alias *CandidateNode
Content []*CandidateNode
HeadComment string
LineComment string
FootComment string
Parent *CandidateNode // parent node
Key *CandidateNode // node key, if this is a value from a map (or index in an array)
LeadingContent string
Line int
Column int
// when performing op against all nodes given, this will treat all the nodes as one
// (e.g. top level cross document merge). This property does not propagate to child nodes.
EvaluateTogether bool
IsMapKey bool
// For formats like HCL and TOML: indicates that child entries should be emitted as separate blocks/tables
// rather than consolidated into nested mappings (default behaviour)
EncodeSeparate bool
// contains filtered or unexported fields
}
func (*CandidateNode) AddChild ¶ added in v4.40.1
func (n *CandidateNode) AddChild(rawChild *CandidateNode)
func (*CandidateNode) AddChildren ¶ added in v4.40.1
func (n *CandidateNode) AddChildren(children []*CandidateNode)
func (*CandidateNode) AddKeyValueChild ¶ added in v4.40.1
func (n *CandidateNode) AddKeyValueChild(rawKey *CandidateNode, rawValue *CandidateNode) (*CandidateNode, *CandidateNode)
func (*CandidateNode) AsList ¶ added in v4.14.1
func (n *CandidateNode) AsList() *list.List
func (*CandidateNode) CanVisitValues ¶ added in v4.45.2
func (n *CandidateNode) CanVisitValues() bool
func (*CandidateNode) ConvertToNodeInfo ¶ added in v4.47.1
func (n *CandidateNode) ConvertToNodeInfo() *NodeInfo
func (*CandidateNode) Copy ¶
func (n *CandidateNode) Copy() *CandidateNode
func (*CandidateNode) CopyAsReplacement ¶ added in v4.40.1
func (n *CandidateNode) CopyAsReplacement(replacement *CandidateNode) *CandidateNode
func (*CandidateNode) CopyWithoutContent ¶ added in v4.40.1
func (n *CandidateNode) CopyWithoutContent() *CandidateNode
func (*CandidateNode) CreateChild ¶ added in v4.3.2
func (n *CandidateNode) CreateChild() *CandidateNode
func (*CandidateNode) CreateReplacement ¶ added in v4.15.1
func (n *CandidateNode) CreateReplacement(kind Kind, tag string, value string) *CandidateNode
func (*CandidateNode) CreateReplacementWithComments ¶ added in v4.40.1
func (n *CandidateNode) CreateReplacementWithComments(kind Kind, tag string, style Style) *CandidateNode
func (*CandidateNode) FilterMapContentByKey ¶ added in v4.47.1
func (n *CandidateNode) FilterMapContentByKey(keyPredicate func(*CandidateNode) bool) []*CandidateNode
func (*CandidateNode) GetDocument ¶ added in v4.40.1
func (n *CandidateNode) GetDocument() uint
func (*CandidateNode) GetFileIndex ¶ added in v4.40.1
func (n *CandidateNode) GetFileIndex() int
func (*CandidateNode) GetFilename ¶ added in v4.40.1
func (n *CandidateNode) GetFilename() string
func (*CandidateNode) GetKey ¶
func (n *CandidateNode) GetKey() string
func (*CandidateNode) GetNicePath ¶ added in v4.16.2
func (n *CandidateNode) GetNicePath() string
func (*CandidateNode) GetPath ¶ added in v4.40.1
func (n *CandidateNode) GetPath() []interface{}
func (*CandidateNode) GetValueRep ¶ added in v4.40.1
func (n *CandidateNode) GetValueRep() (interface{}, error)
func (*CandidateNode) MarshalJSON ¶ added in v4.40.1
func (o *CandidateNode) MarshalJSON() ([]byte, error)
func (*CandidateNode) MarshalYAML ¶ added in v4.40.1
func (o *CandidateNode) MarshalYAML() (*yaml.Node, error)
func (*CandidateNode) SetDocument ¶ added in v4.40.1
func (n *CandidateNode) SetDocument(idx uint)
func (*CandidateNode) SetFileIndex ¶ added in v4.40.1
func (n *CandidateNode) SetFileIndex(idx int)
func (*CandidateNode) SetFilename ¶ added in v4.40.1
func (n *CandidateNode) SetFilename(name string)
func (*CandidateNode) SetParent ¶ added in v4.40.1
func (n *CandidateNode) SetParent(parent *CandidateNode)
func (*CandidateNode) UnmarshalGoccyYAML ¶ added in v4.40.1
func (o *CandidateNode) UnmarshalGoccyYAML(node ast.Node, cm yaml.CommentMap, anchorMap map[string]*CandidateNode) error
func (*CandidateNode) UnmarshalJSON ¶ added in v4.40.1
func (o *CandidateNode) UnmarshalJSON(data []byte) error
func (*CandidateNode) UnmarshalYAML ¶ added in v4.40.1
func (o *CandidateNode) UnmarshalYAML(node *yaml.Node, anchorMap map[string]*CandidateNode) error
func (*CandidateNode) UpdateAttributesFrom ¶
func (n *CandidateNode) UpdateAttributesFrom(other *CandidateNode, prefs assignPreferences)
func (*CandidateNode) UpdateFrom ¶
func (n *CandidateNode) UpdateFrom(other *CandidateNode, prefs assignPreferences)
updates this candidate from the given candidate node
func (*CandidateNode) VisitValues ¶ added in v4.45.2
func (n *CandidateNode) VisitValues(visitor ValueVisitor) error
type Context ¶ added in v4.5.0
type Context struct {
MatchingNodes *list.List
Variables map[string]*list.List
DontAutoCreate bool
// contains filtered or unexported fields
}
func (*Context) ChildContext ¶ added in v4.5.0
func (*Context) GetDateTimeLayout ¶ added in v4.20.1
func (*Context) ReadOnlyClone ¶ added in v4.9.2
func (*Context) SetDateTimeLayout ¶ added in v4.20.1
func (*Context) SetVariable ¶ added in v4.5.0
func (*Context) SingleChildContext ¶ added in v4.5.0
func (n *Context) SingleChildContext(candidate *CandidateNode) Context
func (*Context) SingleReadonlyChildContext ¶ added in v4.9.2
func (n *Context) SingleReadonlyChildContext(candidate *CandidateNode) Context
func (*Context) WritableClone ¶ added in v4.9.7
type CsvPreferences ¶ added in v4.41.1
func NewDefaultCsvPreferences ¶ added in v4.41.1
func NewDefaultCsvPreferences() CsvPreferences
func NewDefaultTsvPreferences ¶ added in v4.41.1
func NewDefaultTsvPreferences() CsvPreferences
type DataTreeNavigator ¶
type DataTreeNavigator interface {
// this will process the against the given expressionNode and return
// a new context of matching candidates
GetMatchingNodes(context Context, expressionNode *ExpressionNode) (Context, error)
}
func NewDataTreeNavigator ¶
func NewDataTreeNavigator() DataTreeNavigator
type Decoder ¶ added in v4.17.1
type Decoder interface {
Init(reader io.Reader) error
Decode() (*CandidateNode, error)
}
func NewBase64Decoder ¶ added in v4.21.1
func NewBase64Decoder() Decoder
func NewCSVObjectDecoder ¶ added in v4.27.1
func NewCSVObjectDecoder(prefs CsvPreferences) Decoder
func NewGoccyYAMLDecoder ¶ added in v4.40.1
func NewGoccyYAMLDecoder() Decoder
func NewHclDecoder ¶ added in v4.50.1
func NewHclDecoder() Decoder
func NewINIDecoder ¶ added in v4.46.1
func NewINIDecoder() Decoder
func NewJSONDecoder ¶ added in v4.27.1
func NewJSONDecoder() Decoder
func NewLuaDecoder ¶ added in v4.40.1
func NewLuaDecoder(prefs LuaPreferences) Decoder
func NewPropertiesDecoder ¶ added in v4.20.1
func NewPropertiesDecoder() Decoder
func NewTomlDecoder ¶ added in v4.33.1
func NewTomlDecoder() Decoder
func NewUriDecoder ¶ added in v4.31.1
func NewUriDecoder() Decoder
func NewXMLDecoder ¶ added in v4.20.1
func NewXMLDecoder(prefs XmlPreferences) Decoder
func NewYamlDecoder ¶ added in v4.17.1
func NewYamlDecoder(prefs YamlPreferences) Decoder
type DecoderFactoryFunction ¶ added in v4.42.1
type DecoderFactoryFunction func() Decoder
type Encoder ¶
type Encoder interface {
Encode(writer io.Writer, node *CandidateNode) error
PrintDocumentSeparator(writer io.Writer) error
PrintLeadingContent(writer io.Writer, content string) error
CanHandleAliases() bool
}
func NewBase64Encoder ¶ added in v4.21.1
func NewBase64Encoder() Encoder
func NewCsvEncoder ¶ added in v4.16.1
func NewCsvEncoder(prefs CsvPreferences) Encoder
func NewHclEncoder ¶ added in v4.50.1
func NewHclEncoder(prefs HclPreferences) Encoder
NewHclEncoder creates a new HCL encoder
func NewINIEncoder ¶ added in v4.46.1
func NewINIEncoder() Encoder
NewINIEncoder creates a new INI encoder
func NewJSONEncoder ¶ added in v4.27.1
func NewJSONEncoder(prefs JsonPreferences) Encoder
func NewLuaEncoder ¶ added in v4.35.1
func NewLuaEncoder(prefs LuaPreferences) Encoder
func NewPropertiesEncoder ¶ added in v4.12.0
func NewPropertiesEncoder(prefs PropertiesPreferences) Encoder
func NewShEncoder ¶ added in v4.31.1
func NewShEncoder() Encoder
func NewShellVariablesEncoder ¶ added in v4.34.1
func NewShellVariablesEncoder() Encoder
func NewTomlEncoder ¶ added in v4.33.3
func NewTomlEncoder() Encoder
func NewUriEncoder ¶ added in v4.31.1
func NewUriEncoder() Encoder
func NewXMLEncoder ¶ added in v4.20.1
func NewXMLEncoder(prefs XmlPreferences) Encoder
func NewYamlEncoder ¶
func NewYamlEncoder(prefs YamlPreferences) Encoder
type EncoderFactoryFunction ¶ added in v4.42.1
type EncoderFactoryFunction func() Encoder
type Evaluator ¶
type Evaluator interface {
EvaluateFiles(expression string, filenames []string, printer Printer, decoder Decoder) error
// EvaluateNodes takes an expression and one or more yaml nodes, returning a list of matching candidate nodes
EvaluateNodes(expression string, nodes ...*CandidateNode) (*list.List, error)
// EvaluateCandidateNodes takes an expression and list of candidate nodes, returning a list of matching candidate nodes
EvaluateCandidateNodes(expression string, inputCandidateNodes *list.List) (*list.List, error)
}
A yaml expression evaluator that runs the expression once against all files/nodes in memory.
func NewAllAtOnceEvaluator ¶
func NewAllAtOnceEvaluator() Evaluator
type ExpressionNode ¶ added in v4.3.2
type ExpressionNode struct {
Operation *Operation
LHS *ExpressionNode
RHS *ExpressionNode
Parent *ExpressionNode
}
type ExpressionParserInterface ¶ added in v4.19.1
type ExpressionParserInterface interface {
ParseExpression(expression string) (*ExpressionNode, error)
}
var ExpressionParser ExpressionParserInterface
type Format ¶ added in v4.42.1
type Format struct {
FormalName string
Names []string
EncoderFactory EncoderFactoryFunction
DecoderFactory DecoderFactoryFunction
}
func FormatFromString ¶ added in v4.42.1
func GetAvailableInputFormats ¶ added in v4.42.1
func GetAvailableInputFormats() []*Format
func GetAvailableOutputFormats ¶ added in v4.42.1
func GetAvailableOutputFormats() []*Format
func (*Format) GetConfiguredEncoder ¶ added in v4.42.1
func (*Format) MatchesName ¶ added in v4.42.1
type HclPreferences ¶ added in v4.50.1
type HclPreferences struct {
ColorsEnabled bool
}
func NewDefaultHclPreferences ¶ added in v4.50.1
func NewDefaultHclPreferences() HclPreferences
func (*HclPreferences) Copy ¶ added in v4.50.1
func (p *HclPreferences) Copy() HclPreferences
type INIPreferences ¶ added in v4.46.1
type INIPreferences struct {
ColorsEnabled bool
}
func NewDefaultINIPreferences ¶ added in v4.46.1
func NewDefaultINIPreferences() INIPreferences
func (*INIPreferences) Copy ¶ added in v4.46.1
func (p *INIPreferences) Copy() INIPreferences
type JsonPreferences ¶ added in v4.42.1
func NewDefaultJsonPreferences ¶ added in v4.42.1
func NewDefaultJsonPreferences() JsonPreferences
func (*JsonPreferences) Copy ¶ added in v4.42.1
func (p *JsonPreferences) Copy() JsonPreferences
type LuaPreferences ¶ added in v4.35.1
func NewDefaultLuaPreferences ¶ added in v4.35.1
func NewDefaultLuaPreferences() LuaPreferences
type NodeInfo ¶ added in v4.47.1
type NodeInfo struct {
Kind string `yaml:"kind"`
Style string `yaml:"style,omitempty"`
Anchor string `yaml:"anchor,omitempty"`
Tag string `yaml:"tag,omitempty"`
HeadComment string `yaml:"headComment,omitempty"`
LineComment string `yaml:"lineComment,omitempty"`
FootComment string `yaml:"footComment,omitempty"`
Value string `yaml:"value,omitempty"`
Line int `yaml:"line,omitempty"`
Column int `yaml:"column,omitempty"`
Content []*NodeInfo `yaml:"content,omitempty"`
}
type Operation ¶
type Operation struct {
OperationType *operationType
Value interface{}
StringValue string
CandidateNode *CandidateNode // used for Value Path elements
Preferences interface{}
UpdateAssign bool // used for assign ops, when true it means we evaluate the rhs given the lhs
}
type Printer ¶
type Printer interface {
PrintResults(matchingNodes *list.List) error
PrintedAnything() bool
//e.g. when given a front-matter doc, like jekyll
SetAppendix(reader io.Reader)
SetNulSepOutput(nulSepOutput bool)
}
func NewNodeInfoPrinter ¶ added in v4.47.1
func NewNodeInfoPrinter(printerWriter PrinterWriter) Printer
func NewPrinter ¶
func NewPrinter(encoder Encoder, printerWriter PrinterWriter) Printer
type PrinterWriter ¶ added in v4.14.1
type PrinterWriter interface {
GetWriter(node *CandidateNode) (*bufio.Writer, error)
}
func NewMultiPrinterWriter ¶ added in v4.14.1
func NewMultiPrinterWriter(expression *ExpressionNode, format *Format) PrinterWriter
func NewSinglePrinterWriter ¶ added in v4.14.1
func NewSinglePrinterWriter(writer io.Writer) PrinterWriter
type PropertiesPreferences ¶ added in v4.42.1
type PropertiesPreferences struct {
UnwrapScalar bool
KeyValueSeparator string
UseArrayBrackets bool
}
func NewDefaultPropertiesPreferences ¶ added in v4.42.1
func NewDefaultPropertiesPreferences() PropertiesPreferences
func (*PropertiesPreferences) Copy ¶ added in v4.42.1
func (p *PropertiesPreferences) Copy() PropertiesPreferences
type SecurityPreferences ¶ added in v4.49.1
type ShellVariablesPreferences ¶ added in v4.48.2
type ShellVariablesPreferences struct {
KeySeparator string
}
func NewDefaultShellVariablesPreferences ¶ added in v4.48.2
func NewDefaultShellVariablesPreferences() ShellVariablesPreferences
type StreamEvaluator ¶
type StreamEvaluator interface {
Evaluate(filename string, reader io.Reader, node *ExpressionNode, printer Printer, decoder Decoder) (uint, error)
EvaluateFiles(expression string, filenames []string, printer Printer, decoder Decoder) error
EvaluateNew(expression string, printer Printer) error
}
A yaml expression evaluator that runs the expression multiple times for each given yaml document. Uses less memory than loading all documents and running the expression once, but this cannot process cross document expressions.
func NewStreamEvaluator ¶
func NewStreamEvaluator() StreamEvaluator
type StringEvaluator ¶ added in v4.27.1
type StringEvaluator interface {
Evaluate(expression string, input string, encoder Encoder, decoder Decoder) (string, error)
EvaluateAll(expression string, input string, encoder Encoder, decoder Decoder) (string, error)
}
func NewStringEvaluator ¶ added in v4.27.1
func NewStringEvaluator() StringEvaluator
type ValueVisitor ¶ added in v4.45.2
type ValueVisitor func(*CandidateNode) error
type XmlPreferences ¶ added in v4.17.1
type XmlPreferences struct {
Indent int
AttributePrefix string
ContentName string
StrictMode bool
KeepNamespace bool
UseRawToken bool
ProcInstPrefix string
DirectiveName string
SkipProcInst bool
SkipDirectives bool
}
func NewDefaultXmlPreferences ¶ added in v4.29.1
func NewDefaultXmlPreferences() XmlPreferences
func (*XmlPreferences) Copy ¶ added in v4.42.1
func (p *XmlPreferences) Copy() XmlPreferences
type YamlPreferences ¶ added in v4.29.1
type YamlPreferences struct {
Indent int
ColorsEnabled bool
LeadingContentPreProcessing bool
PrintDocSeparators bool
UnwrapScalar bool
EvaluateTogether bool
FixMergeAnchorToSpec bool
}
func NewDefaultYamlPreferences ¶ added in v4.29.1
func NewDefaultYamlPreferences() YamlPreferences
func (*YamlPreferences) Copy ¶ added in v4.42.1
func (p *YamlPreferences) Copy() YamlPreferences
Source Files
¶
- all_at_once_evaluator.go
- candidate_node.go
- candidate_node_goccy_yaml.go
- candidate_node_yaml.go
- candidiate_node_json.go
- chown_linux.go
- color_print.go
- context.go
- csv.go
- data_tree_navigator.go
- decoder.go
- decoder_base64.go
- decoder_csv_object.go
- decoder_goccy_yaml.go
- decoder_hcl.go
- decoder_ini.go
- decoder_json.go
- decoder_lua.go
- decoder_properties.go
- decoder_toml.go
- decoder_uri.go
- decoder_xml.go
- decoder_yaml.go
- encoder.go
- encoder_base64.go
- encoder_csv.go
- encoder_hcl.go
- encoder_ini.go
- encoder_json.go
- encoder_lua.go
- encoder_properties.go
- encoder_sh.go
- encoder_shellvariables.go
- encoder_toml.go
- encoder_uri.go
- encoder_xml.go
- encoder_yaml.go
- expression_parser.go
- expression_postfix.go
- file_utils.go
- format.go
- front_matter.go
- hcl.go
- ini.go
- json.go
- lexer.go
- lexer_participle.go
- lib.go
- lua.go
- matchKeyString.go
- operation.go
- operator_add.go
- operator_alternative.go
- operator_anchors_aliases.go
- operator_assign.go
- operator_booleans.go
- operator_collect.go
- operator_collect_object.go
- operator_column.go
- operator_comments.go
- operator_compare.go
- operator_contains.go
- operator_create_map.go
- operator_datetime.go
- operator_delete.go
- operator_divide.go
- operator_document_index.go
- operator_encoder_decoder.go
- operator_entries.go
- operator_env.go
- operator_equals.go
- operator_error.go
- operator_eval.go
- operator_expression.go
- operator_file.go
- operator_filter.go
- operator_first.go
- operator_flatten.go
- operator_group_by.go
- operator_has.go
- operator_keys.go
- operator_kind.go
- operator_length.go
- operator_line.go
- operator_load.go
- operator_map.go
- operator_modulo.go
- operator_multiply.go
- operator_omit.go
- operator_parent.go
- operator_path.go
- operator_pick.go
- operator_pipe.go
- operator_pivot.go
- operator_recursive_descent.go
- operator_reduce.go
- operator_reverse.go
- operator_select.go
- operator_self.go
- operator_shuffle.go
- operator_slice.go
- operator_sort.go
- operator_sort_keys.go
- operator_split_document.go
- operator_strings.go
- operator_style.go
- operator_subtract.go
- operator_tag.go
- operator_to_number.go
- operator_traverse_path.go
- operator_union.go
- operator_unique.go
- operator_value.go
- operator_variables.go
- operator_with.go
- operators.go
- printer.go
- printer_node_info.go
- printer_writer.go
- properties.go
- security_prefs.go
- shellvariables.go
- stream_evaluator.go
- string_evaluator.go
- utils.go
- write_in_place_handler.go
- xml.go
- yaml.go
Click to show internal directories.
Click to hide internal directories.