Documentation
¶
Index ¶
- Constants
- Variables
- func Copy(value interface{}) interface{}
- func FindYAMLNode(node *yaml.Node, path ...PathElement) *yaml.Node
- func IsBool(value interface{}) bool
- func IsFloat(value interface{}) bool
- func IsInteger(value interface{}) bool
- func IsList(value interface{}) bool
- func IsMap(value interface{}) bool
- func IsString(value interface{}) bool
- func IsTime(value interface{}) bool
- func MergeMaps(target Map, source Map, mergeLists bool)
- func Read(reader io.Reader, format string, locate bool) (Map, Locator, error)
- func ReadFromURL(url urlpkg.URL, 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 ToMaps(value interface{}) (interface{}, bool)
- func ToStringMaps(value interface{}) (interface{}, bool)
- func ToYAMLDocumentNode(value interface{}, verbose bool) *yaml.Node
- func ToYAMLNode(value interface{}, verbose bool) *yaml.Node
- func TypeName(value interface{}) string
- type List
- type Locator
- type Map
- type Path
- type PathElement
- type StringMap
- type TypeValidator
- type YAMLLocator
Constants ¶
const ( FieldPathType = iota MapPathType = iota ListPathType = iota )
Variables ¶
var TypeValidators = map[string]TypeValidator{ "!!map": IsMap, "!!seq": IsList, "!!str": IsString, "!!bool": IsBool, "!!int": IsInteger, "!!float": IsFloat, "!!timestamp": IsTime, }
Functions ¶
func FindYAMLNode ¶
func FindYAMLNode(node *yaml.Node, path ...PathElement) *yaml.Node
func IsInteger ¶ added in v0.12.0
func IsInteger(value interface{}) bool
int64, int32, int16, int8, int, uint64, uint32, uint16, uint8, uint
func ToStringMaps ¶
func ToStringMaps(value interface{}) (interface{}, bool)
func ToYAMLDocumentNode ¶ added in v0.12.0
func ToYAMLDocumentNode(value interface{}, verbose bool) *yaml.Node
func ToYAMLNode ¶ added in v0.12.0
func ToYAMLNode(value interface{}, verbose bool) *yaml.Node
Types ¶
type List ¶
type List = []interface{}
Note: This is just a convenient alias, *not* a type. An extra type would ensure more strictness but would make life more complicated than it needs to be. That said, if we *do* want to make this into a type, we need to make sure not to add any methods to the type, otherwise the goja JavaScript engine will treat it as a host object instead of a regular JavaScript dict object.
type Map ¶
type Map = map[interface{}]interface{}
Note: This is just a convenient alias, *not* a type. An extra type would ensure more strictness but would make life more complicated than it needs to be. That said, if we *do* want to make this into a type, we need to make sure not to add any methods to the type, otherwise the goja JavaScript engine will treat it as a host object instead of a regular JavaScript dict object.
func EnsureMaps ¶
func EnsureMaps(map_ interface{}) Map
type Path ¶
type Path []PathElement
type PathElement ¶
type PathElement struct { Type int Value interface{} // string for FieldPathType and MapPathType, int for ListPathType }
func NewFieldPathElement ¶
func NewFieldPathElement(name string) PathElement
func NewListPathElement ¶
func NewListPathElement(index int) PathElement
func NewMapPathElement ¶
func NewMapPathElement(name string) PathElement
type StringMap ¶
type StringMap = map[string]interface{}
func EnsureStringMaps ¶
func EnsureStringMaps(map_ interface{}) StringMap
func ToStringMap ¶
type TypeValidator ¶ added in v0.12.0
type TypeValidator = func(interface{}) bool
type YAMLLocator ¶
type YAMLLocator struct {
RootNode *yaml.Node
}
func NewYAMLLocator ¶
func NewYAMLLocator(rootNode *yaml.Node) *YAMLLocator
func (*YAMLLocator) Locate ¶
func (self *YAMLLocator) Locate(path ...PathElement) (int, int, bool)
Locator interface