Tweak sequence treatment in fieldspecs

This commit is contained in:
Jeff Regan
2020-07-17 19:48:06 -07:00
committed by jregan
12 changed files with 162 additions and 51 deletions

View File

@@ -16,9 +16,21 @@ import (
)
const (
// NullNodeTag is the tag set for a yaml.Document that contains no data -- e.g. it isn't a
// Map, Slice, Document, etc
NullNodeTag = "!!null"
// NodeTagNull is the tag set for a yaml.Document that contains no data;
// e.g. it isn't a Map, Slice, Document, etc
NodeTagNull = "!!null"
NodeTagFloat = "!!float"
NodeTagString = "!!str"
NodeTagBool = "!!bool"
NodeTagInt = "!!int"
NodeTagMap = "!!map"
NodeTagEmpty = ""
// TODO: deprecate these
NullNodeTag = NodeTagNull
StringTag = NodeTagString
BoolTag = NodeTagBool
IntTag = NodeTagInt
)
// NullNode returns a RNode point represents a null; value
@@ -604,12 +616,6 @@ func (rn *RNode) VisitFields(fn func(node *MapNode) error) error {
return nil
}
const (
StringTag = "!!str"
BoolTag = "!!bool"
IntTag = "!!int"
)
// Elements returns the list of elements in the RNode.
// Returns an error for non-SequenceNodes.
func (rn *RNode) Elements() ([]*RNode, error) {