Documentation
¶
Index ¶
- Constants
- Variables
- func Equals(a Value, b Value) bool
- func FindYAMLNode(node *yaml.Node, path ...PathElement) *yaml.Node
- func IsBoolean(value Value) bool
- func IsFloat(value Value) bool
- func IsInteger(value Value) bool
- func IsList(value Value) bool
- func IsMap(value Value) bool
- func IsNull(value Value) bool
- func IsString(value Value) bool
- func IsTimestamp(value Value) bool
- func MergeMaps(target Map, source Map, mergeLists bool)
- func MergeStringMaps(target StringMap, source StringMap, mergeLists bool)
- func Read(reader io.Reader, format string, locate bool) (Map, Locator, error)
- func ReadJSON(reader io.Reader, locate bool) (Map, Locator, error)
- func ReadYAML(reader io.Reader, locate bool) (Map, Locator, error)
- func StringMapPutNested(map_ StringMap, key string, value string) error
- func ToYAMLDocumentNode(value Value, verbose bool) *yaml.Node
- func ToYAMLNode(value Value, verbose bool) *yaml.Node
- func ValueToString(data Value) string
- type List
- type Locator
- type Map
- type Node
- func (self *Node) Append(value interface{}) bool
- func (self *Node) Boolean(allowNil bool) (bool, bool)
- func (self *Node) Float(allowNil bool) (float64, bool)
- func (self *Node) Get(key string) *Node
- func (self *Node) Integer(allowNil bool) (int64, bool)
- func (self *Node) List(allowNil bool) (List, bool)
- func (self *Node) Map(allowNil bool) (Map, bool)
- func (self *Node) Put(key string, value interface{}) bool
- func (self *Node) String(allowNil bool) (string, bool)
- func (self *Node) StringMap(allowNil bool) (StringMap, bool)
- func (self *Node) UnsignedInteger(allowNil bool) (uint64, bool)
- type Path
- type PathElement
- type PathElementType
- type StringMap
- type TypeName
- type TypeValidator
- type Value
- type YAMLLocator
Constants ¶
View Source
const ( FieldPathType = iota MapPathType ListPathType SequencedListPathType )
Variables ¶
View Source
var NoNode = &Node{nil, nil, ""}
View Source
var TypeValidators = map[TypeName]TypeValidator{ TypeMap: IsMap, TypeList: IsList, TypeString: IsString, TypeBoolean: IsBoolean, TypeInteger: IsInteger, TypeFloat: IsFloat, TypeNull: IsNull, TypeTimestamp: IsTimestamp, }
View Source
var TypeZeroes = map[TypeName]Value{ TypeMap: make(Map), TypeList: List{}, TypeString: "", TypeBoolean: false, TypeInteger: int(0), TypeFloat: float64(0.0), TypeNull: nil, TypeTimestamp: time.Time{}, }
Functions ¶
func FindYAMLNode ¶
func FindYAMLNode(node *yaml.Node, path ...PathElement) *yaml.Node
func MergeStringMaps ¶
func StringMapPutNested ¶
TODO: use Node instead
func ValueToString ¶
Types ¶
type Map ¶
func EnsureMaps ¶
type Path ¶
type Path []PathElement
func (Path) Append ¶
func (self Path) Append(element PathElement) Path
func (Path) AppendField ¶
func (Path) AppendList ¶
func (Path) AppendSequencedList ¶
type PathElement ¶
type PathElement struct {
Type PathElementType
Value interface{} // string for FieldPathType and MapPathType, int for ListPathType and SequencedListPathType
}
func NewFieldPathElement ¶
func NewFieldPathElement(name string) PathElement
func NewListPathElement ¶
func NewListPathElement(index int) PathElement
func NewMapPathElement ¶
func NewMapPathElement(name string) PathElement
func NewSequencedListPathElement ¶
func NewSequencedListPathElement(index int) PathElement
type PathElementType ¶
type PathElementType uint8
type TypeName ¶
type TypeName string
const ( NoType TypeName = "" // Failsafe schema: https://yaml.org/spec/1.2/spec.html#id2802346 TypeMap TypeName = "ard.map" TypeList TypeName = "ard.list" TypeString TypeName = "ard.string" // JSON schema: https://yaml.org/spec/1.2/spec.html#id2803231 TypeBoolean TypeName = "ard.boolean" TypeInteger TypeName = "ard.integer" TypeFloat TypeName = "ard.float" // Other schemas: https://yaml.org/spec/1.2/spec.html#id2805770 TypeNull TypeName = "ard.null" TypeTimestamp TypeName = "ard.timestamp" )
func GetTypeName ¶
type TypeValidator ¶
type YAMLLocator ¶
func NewYAMLLocator ¶
func NewYAMLLocator(rootNode *yaml.Node) *YAMLLocator
func (*YAMLLocator) Locate ¶
func (self *YAMLLocator) Locate(path ...PathElement) (int, int, bool)
Locator interface
Click to show internal directories.
Click to hide internal directories.