Documentation ¶
Index ¶
- Variables
- func Merge(dst Node, src Node) error
- func Walk(v Visitor, node Node)
- type AliasNode
- type AnchorNode
- func (n *AnchorNode) AddColumn(col int)
- func (n *AnchorNode) GetToken() *token.Token
- func (n *AnchorNode) MarshalYAML() ([]byte, error)
- func (n *AnchorNode) Read(p []byte) (int, error)
- func (n *AnchorNode) SetName(name string) error
- func (n *AnchorNode) String() string
- func (n *AnchorNode) Type() NodeType
- type ArrayNode
- type ArrayNodeIter
- type BaseNode
- type BoolNode
- type CommentGroupNode
- func (n *CommentGroupNode) AddColumn(col int)
- func (n *CommentGroupNode) GetToken() *token.Token
- func (n *CommentGroupNode) MarshalYAML() ([]byte, error)
- func (n *CommentGroupNode) Read(p []byte) (int, error)
- func (n *CommentGroupNode) String() string
- func (n *CommentGroupNode) StringWithSpace(col int) string
- func (n *CommentGroupNode) Type() NodeType
- type CommentNode
- type DirectiveNode
- type DocumentNode
- type ErrInvalidMergeType
- type File
- type FloatNode
- type InfinityNode
- func (n *InfinityNode) AddColumn(col int)
- func (n *InfinityNode) GetToken() *token.Token
- func (n *InfinityNode) GetValue() interface{}
- func (n *InfinityNode) MarshalYAML() ([]byte, error)
- func (n *InfinityNode) Read(p []byte) (int, error)
- func (n *InfinityNode) String() string
- func (n *InfinityNode) Type() NodeType
- type IntegerNode
- func (n *IntegerNode) AddColumn(col int)
- func (n *IntegerNode) GetToken() *token.Token
- func (n *IntegerNode) GetValue() interface{}
- func (n *IntegerNode) MarshalYAML() ([]byte, error)
- func (n *IntegerNode) Read(p []byte) (int, error)
- func (n *IntegerNode) String() string
- func (n *IntegerNode) Type() NodeType
- type LiteralNode
- func (n *LiteralNode) AddColumn(col int)
- func (n *LiteralNode) GetToken() *token.Token
- func (n *LiteralNode) GetValue() interface{}
- func (n *LiteralNode) MarshalYAML() ([]byte, error)
- func (n *LiteralNode) Read(p []byte) (int, error)
- func (n *LiteralNode) String() string
- func (n *LiteralNode) Type() NodeType
- type MapNode
- type MapNodeIter
- type MappingKeyNode
- type MappingNode
- func (n *MappingNode) AddColumn(col int)
- func (n *MappingNode) GetToken() *token.Token
- func (n *MappingNode) MapRange() *MapNodeIter
- func (n *MappingNode) MarshalYAML() ([]byte, error)
- func (n *MappingNode) Merge(target *MappingNode)
- func (n *MappingNode) Read(p []byte) (int, error)
- func (n *MappingNode) SetIsFlowStyle(isFlow bool)
- func (n *MappingNode) String() string
- func (n *MappingNode) Type() NodeType
- type MappingValueNode
- func (n *MappingValueNode) AddColumn(col int)
- func (n *MappingValueNode) GetToken() *token.Token
- func (n *MappingValueNode) MapRange() *MapNodeIter
- func (n *MappingValueNode) MarshalYAML() ([]byte, error)
- func (n *MappingValueNode) Read(p []byte) (int, error)
- func (n *MappingValueNode) Replace(value Node) error
- func (n *MappingValueNode) SetIsFlowStyle(isFlow bool)
- func (n *MappingValueNode) String() string
- func (n *MappingValueNode) Type() NodeType
- type MergeKeyNode
- func (n *MergeKeyNode) AddColumn(col int)
- func (n *MergeKeyNode) GetToken() *token.Token
- func (n *MergeKeyNode) GetValue() interface{}
- func (n *MergeKeyNode) MarshalYAML() ([]byte, error)
- func (n *MergeKeyNode) Read(p []byte) (int, error)
- func (n *MergeKeyNode) String() string
- func (n *MergeKeyNode) Type() NodeType
- type NanNode
- type Node
- type NodeType
- type NullNode
- type ScalarNode
- type SequenceNode
- func (n *SequenceNode) AddColumn(col int)
- func (n *SequenceNode) ArrayRange() *ArrayNodeIter
- func (n *SequenceNode) GetToken() *token.Token
- func (n *SequenceNode) MarshalYAML() ([]byte, error)
- func (n *SequenceNode) Merge(target *SequenceNode)
- func (n *SequenceNode) Read(p []byte) (int, error)
- func (n *SequenceNode) Replace(idx int, value Node) error
- func (n *SequenceNode) SetIsFlowStyle(isFlow bool)
- func (n *SequenceNode) String() string
- func (n *SequenceNode) Type() NodeType
- type StringNode
- func (n *StringNode) AddColumn(col int)
- func (n *StringNode) GetToken() *token.Token
- func (n *StringNode) GetValue() interface{}
- func (n *StringNode) MarshalYAML() ([]byte, error)
- func (n *StringNode) Read(p []byte) (int, error)
- func (n *StringNode) String() string
- func (n *StringNode) Type() NodeType
- type TagNode
- type Visitor
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type AliasNode ¶
AliasNode type of alias node
func (*AliasNode) MarshalYAML ¶
MarshalYAML encodes to a YAML text
type AnchorNode ¶
AnchorNode type of anchor node
func Anchor ¶
func Anchor(tk *token.Token) *AnchorNode
func (*AnchorNode) AddColumn ¶
func (n *AnchorNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*AnchorNode) GetToken ¶
func (n *AnchorNode) GetToken() *token.Token
GetToken returns token instance
func (*AnchorNode) MarshalYAML ¶
func (n *AnchorNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
func (*AnchorNode) Read ¶
func (n *AnchorNode) Read(p []byte) (int, error)
Read implements (io.Reader).Read
func (*AnchorNode) SetName ¶
func (n *AnchorNode) SetName(name string) error
type ArrayNode ¶
type ArrayNode interface {
ArrayRange() *ArrayNodeIter
}
ArrayNode interface of SequenceNode
type ArrayNodeIter ¶
type ArrayNodeIter struct {
// contains filtered or unexported fields
}
ArrayNodeIter is an iterator for ranging over a ArrayNode
func (*ArrayNodeIter) Next ¶
func (m *ArrayNodeIter) Next() bool
Next advances the array iterator and reports whether there is another entry. It returns false when the iterator is exhausted.
func (*ArrayNodeIter) Value ¶
func (m *ArrayNodeIter) Value() Node
Value returns the value of the iterator's current array entry.
type BaseNode ¶
type BaseNode struct { Comment *CommentGroupNode // contains filtered or unexported fields }
func (*BaseNode) GetComment ¶
func (n *BaseNode) GetComment() *CommentGroupNode
GetComment returns comment token instance
func (*BaseNode) SetComment ¶
func (n *BaseNode) SetComment(node *CommentGroupNode) error
SetComment set comment token
type BoolNode ¶
BoolNode type of boolean node
func (*BoolNode) GetValue ¶
func (n *BoolNode) GetValue() interface{}
GetValue returns boolean value
func (*BoolNode) MarshalYAML ¶
MarshalYAML encodes to a YAML text
type CommentGroupNode ¶
type CommentGroupNode struct { *BaseNode Comments []*CommentNode }
CommentGroupNode type of comment node
func CommentGroup ¶
func CommentGroup(comments []*token.Token) *CommentGroupNode
func (*CommentGroupNode) AddColumn ¶
func (n *CommentGroupNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*CommentGroupNode) GetToken ¶
func (n *CommentGroupNode) GetToken() *token.Token
GetToken returns token instance
func (*CommentGroupNode) MarshalYAML ¶
func (n *CommentGroupNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
func (*CommentGroupNode) Read ¶
func (n *CommentGroupNode) Read(p []byte) (int, error)
Read implements (io.Reader).Read
func (*CommentGroupNode) StringWithSpace ¶
func (n *CommentGroupNode) StringWithSpace(col int) string
type CommentNode ¶
CommentNode type of comment node
func (*CommentNode) AddColumn ¶
func (n *CommentNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*CommentNode) GetToken ¶
func (n *CommentNode) GetToken() *token.Token
GetToken returns token instance
func (*CommentNode) MarshalYAML ¶
func (n *CommentNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
type DirectiveNode ¶
DirectiveNode type of directive node
func Directive ¶
func Directive(tk *token.Token) *DirectiveNode
func (*DirectiveNode) AddColumn ¶
func (n *DirectiveNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*DirectiveNode) GetToken ¶
func (n *DirectiveNode) GetToken() *token.Token
GetToken returns token instance
func (*DirectiveNode) MarshalYAML ¶
func (n *DirectiveNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
type DocumentNode ¶
type DocumentNode struct { *BaseNode Start *token.Token // position of DocumentHeader ( `---` ) End *token.Token // position of DocumentEnd ( `...` ) Body Node }
DocumentNode type of Document
func (*DocumentNode) AddColumn ¶
func (d *DocumentNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*DocumentNode) GetToken ¶
func (d *DocumentNode) GetToken() *token.Token
GetToken returns token instance
func (*DocumentNode) MarshalYAML ¶
func (d *DocumentNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
type ErrInvalidMergeType ¶
type ErrInvalidMergeType struct {
// contains filtered or unexported fields
}
func (*ErrInvalidMergeType) Error ¶
func (e *ErrInvalidMergeType) Error() string
type File ¶
type File struct { Name string Docs []*DocumentNode }
File contains all documents in YAML file
type FloatNode ¶
FloatNode type of float node
func (*FloatNode) GetValue ¶
func (n *FloatNode) GetValue() interface{}
GetValue returns float64 value
func (*FloatNode) MarshalYAML ¶
MarshalYAML encodes to a YAML text
type InfinityNode ¶
InfinityNode type of infinity node
func Infinity ¶
func Infinity(tk *token.Token) *InfinityNode
Infinity create node for .inf or -.inf value
func (*InfinityNode) AddColumn ¶
func (n *InfinityNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*InfinityNode) GetToken ¶
func (n *InfinityNode) GetToken() *token.Token
GetToken returns token instance
func (*InfinityNode) GetValue ¶
func (n *InfinityNode) GetValue() interface{}
GetValue returns math.Inf(0) or math.Inf(-1)
func (*InfinityNode) MarshalYAML ¶
func (n *InfinityNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
type IntegerNode ¶
IntegerNode type of integer node
func (*IntegerNode) AddColumn ¶
func (n *IntegerNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*IntegerNode) GetToken ¶
func (n *IntegerNode) GetToken() *token.Token
GetToken returns token instance
func (*IntegerNode) GetValue ¶
func (n *IntegerNode) GetValue() interface{}
GetValue returns int64 value
func (*IntegerNode) MarshalYAML ¶
func (n *IntegerNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
type LiteralNode ¶
type LiteralNode struct { *BaseNode Start *token.Token Value *StringNode }
LiteralNode type of literal node
func Literal ¶
func Literal(tk *token.Token) *LiteralNode
func (*LiteralNode) AddColumn ¶
func (n *LiteralNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*LiteralNode) GetToken ¶
func (n *LiteralNode) GetToken() *token.Token
GetToken returns token instance
func (*LiteralNode) GetValue ¶
func (n *LiteralNode) GetValue() interface{}
GetValue returns string value
func (*LiteralNode) MarshalYAML ¶
func (n *LiteralNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
type MapNode ¶
type MapNode interface {
MapRange() *MapNodeIter
}
MapNode interface of MappingValueNode / MappingNode
type MapNodeIter ¶
type MapNodeIter struct {
// contains filtered or unexported fields
}
MapNodeIter is an iterator for ranging over a MapNode
func (*MapNodeIter) Key ¶
func (m *MapNodeIter) Key() Node
Key returns the key of the iterator's current map node entry.
func (*MapNodeIter) Next ¶
func (m *MapNodeIter) Next() bool
Next advances the map iterator and reports whether there is another entry. It returns false when the iterator is exhausted.
func (*MapNodeIter) Value ¶
func (m *MapNodeIter) Value() Node
Value returns the value of the iterator's current map node entry.
type MappingKeyNode ¶
MappingKeyNode type of tag node
func MappingKey ¶
func MappingKey(tk *token.Token) *MappingKeyNode
MappingKey create node for map key ( '?' ).
func (*MappingKeyNode) AddColumn ¶
func (n *MappingKeyNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*MappingKeyNode) GetToken ¶
func (n *MappingKeyNode) GetToken() *token.Token
GetToken returns token instance
func (*MappingKeyNode) MarshalYAML ¶
func (n *MappingKeyNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
type MappingNode ¶
type MappingNode struct { *BaseNode Start *token.Token End *token.Token IsFlowStyle bool Values []*MappingValueNode }
MappingNode type of mapping node
func Mapping ¶
func Mapping(tk *token.Token, isFlowStyle bool, values ...*MappingValueNode) *MappingNode
Mapping create node for map
func (*MappingNode) AddColumn ¶
func (n *MappingNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*MappingNode) GetToken ¶
func (n *MappingNode) GetToken() *token.Token
GetToken returns token instance
func (*MappingNode) MapRange ¶
func (n *MappingNode) MapRange() *MapNodeIter
MapRange implements MapNode protocol
func (*MappingNode) MarshalYAML ¶
func (n *MappingNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
func (*MappingNode) Merge ¶
func (n *MappingNode) Merge(target *MappingNode)
Merge merge key/value of map.
func (*MappingNode) Read ¶
func (n *MappingNode) Read(p []byte) (int, error)
Read implements (io.Reader).Read
func (*MappingNode) SetIsFlowStyle ¶
func (n *MappingNode) SetIsFlowStyle(isFlow bool)
SetIsFlowStyle set value to IsFlowStyle field recursively.
type MappingValueNode ¶
MappingValueNode type of mapping value
func MappingValue ¶
func MappingValue(tk *token.Token, key Node, value Node) *MappingValueNode
MappingValue create node for mapping value
func (*MappingValueNode) AddColumn ¶
func (n *MappingValueNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*MappingValueNode) GetToken ¶
func (n *MappingValueNode) GetToken() *token.Token
GetToken returns token instance
func (*MappingValueNode) MapRange ¶
func (n *MappingValueNode) MapRange() *MapNodeIter
MapRange implements MapNode protocol
func (*MappingValueNode) MarshalYAML ¶
func (n *MappingValueNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
func (*MappingValueNode) Read ¶
func (n *MappingValueNode) Read(p []byte) (int, error)
Read implements (io.Reader).Read
func (*MappingValueNode) Replace ¶
func (n *MappingValueNode) Replace(value Node) error
Replace replace value node.
func (*MappingValueNode) SetIsFlowStyle ¶
func (n *MappingValueNode) SetIsFlowStyle(isFlow bool)
SetIsFlowStyle set value to IsFlowStyle field recursively.
func (*MappingValueNode) String ¶
func (n *MappingValueNode) String() string
String mapping value to text
func (*MappingValueNode) Type ¶
func (n *MappingValueNode) Type() NodeType
Type returns MappingValueType
type MergeKeyNode ¶
MergeKeyNode type of merge key node
func MergeKey ¶
func MergeKey(tk *token.Token) *MergeKeyNode
MergeKey create node for merge key ( << )
func (*MergeKeyNode) AddColumn ¶
func (n *MergeKeyNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*MergeKeyNode) GetToken ¶
func (n *MergeKeyNode) GetToken() *token.Token
GetToken returns token instance
func (*MergeKeyNode) GetValue ¶
func (n *MergeKeyNode) GetValue() interface{}
GetValue returns '<<' value
func (*MergeKeyNode) MarshalYAML ¶
func (n *MergeKeyNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
type NanNode ¶
NanNode type of nan node
func (*NanNode) MarshalYAML ¶
MarshalYAML encodes to a YAML text
type Node ¶
type Node interface { io.Reader // String node to text String() string // GetToken returns token instance GetToken() *token.Token // Type returns type of node Type() NodeType // AddColumn add column number to child nodes recursively AddColumn(int) // SetComment set comment token to node SetComment(*CommentGroupNode) error // Comment returns comment token instance GetComment() *CommentGroupNode // MarshalYAML MarshalYAML() ([]byte, error) // contains filtered or unexported methods }
Node type of node
func FilterFile ¶
FilterFile returns a list of nodes that match the given type.
type NodeType ¶
type NodeType int
NodeType type identifier of node
const ( // UnknownNodeType type identifier for default UnknownNodeType NodeType = iota // DocumentType type identifier for document node DocumentType // NullType type identifier for null node NullType // BoolType type identifier for boolean node BoolType // IntegerType type identifier for integer node IntegerType // FloatType type identifier for float node FloatType // InfinityType type identifier for infinity node InfinityType // NanType type identifier for nan node NanType // StringType type identifier for string node StringType // MergeKeyType type identifier for merge key node MergeKeyType // LiteralType type identifier for literal node LiteralType // MappingType type identifier for mapping node MappingType // MappingKeyType type identifier for mapping key node MappingKeyType // MappingValueType type identifier for mapping value node MappingValueType // SequenceType type identifier for sequence node SequenceType // AnchorType type identifier for anchor node AnchorType // AliasType type identifier for alias node AliasType // DirectiveType type identifier for directive node DirectiveType // TagType type identifier for tag node TagType // CommentType type identifier for comment node CommentType // CommentGroupType type identifier for comment group node CommentGroupType )
func (NodeType) YAMLName ¶
String node type identifier to YAML Structure name based on https://yaml.org/spec/1.2/spec.html
type NullNode ¶
NullNode type of null node
func (*NullNode) MarshalYAML ¶
MarshalYAML encodes to a YAML text
type ScalarNode ¶
type ScalarNode interface { Node GetValue() interface{} }
ScalarNode type for scalar node
type SequenceNode ¶
type SequenceNode struct { *BaseNode Start *token.Token End *token.Token IsFlowStyle bool Values []Node ValueComments []*CommentGroupNode }
SequenceNode type of sequence node
func Sequence ¶
func Sequence(tk *token.Token, isFlowStyle bool) *SequenceNode
Sequence create node for sequence
func (*SequenceNode) AddColumn ¶
func (n *SequenceNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*SequenceNode) ArrayRange ¶
func (n *SequenceNode) ArrayRange() *ArrayNodeIter
ArrayRange implements ArrayNode protocol
func (*SequenceNode) GetToken ¶
func (n *SequenceNode) GetToken() *token.Token
GetToken returns token instance
func (*SequenceNode) MarshalYAML ¶
func (n *SequenceNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
func (*SequenceNode) Merge ¶
func (n *SequenceNode) Merge(target *SequenceNode)
Merge merge sequence value.
func (*SequenceNode) Read ¶
func (n *SequenceNode) Read(p []byte) (int, error)
Read implements (io.Reader).Read
func (*SequenceNode) Replace ¶
func (n *SequenceNode) Replace(idx int, value Node) error
Replace replace value node.
func (*SequenceNode) SetIsFlowStyle ¶
func (n *SequenceNode) SetIsFlowStyle(isFlow bool)
SetIsFlowStyle set value to IsFlowStyle field recursively.
type StringNode ¶
StringNode type of string node
func (*StringNode) AddColumn ¶
func (n *StringNode) AddColumn(col int)
AddColumn add column number to child nodes recursively
func (*StringNode) GetToken ¶
func (n *StringNode) GetToken() *token.Token
GetToken returns token instance
func (*StringNode) GetValue ¶
func (n *StringNode) GetValue() interface{}
GetValue returns string value
func (*StringNode) MarshalYAML ¶
func (n *StringNode) MarshalYAML() ([]byte, error)
MarshalYAML encodes to a YAML text
func (*StringNode) Read ¶
func (n *StringNode) Read(p []byte) (int, error)
Read implements (io.Reader).Read
func (*StringNode) String ¶
func (n *StringNode) String() string
String string value to text with quote or literal header if required
type TagNode ¶
TagNode type of tag node
func (*TagNode) MarshalYAML ¶
MarshalYAML encodes to a YAML text