Documentation ¶
Index ¶
Constants ¶
const ( KindNil = Kind(1 << iota) KindObject KindArray KindString KindInt KindUint KindFloat KindBool )
const ( KindsValues = KindString | KindInt | KindUint | KindFloat | KindBool KindsNotNil = KindObject | KindArray | KindsValues KindsAny = KindNil | KindsNotNil )
Variables ¶
This section is empty.
Functions ¶
func WalkPreOrder ¶
WalkPreOrder visits all nodes of the tree in pre-order.
Types ¶
type Array ¶
type Array []Node
Array is an ordered list of nodes.
func (Array) EqualArray ¶
type Node ¶
type Node interface { // Clone creates a deep copy of the node. Clone() Node Native() interface{} Equal(n2 Node) bool // contains filtered or unexported methods }
Node is a generic interface for a tree structure.
Can be one of:
- Object
- Array
- Value
func Apply ¶
Apply takes a root node and applies callback to each node of the tree recursively. Apply returns an old or a new node and a flag that indicates if node was changed or not. If callback returns true and a new node, Apply will make a copy of parent node and will replace an old value with a new one. It will make a copy of all parent nodes recursively in this case.
func ToNode ¶
func ToNode(o interface{}, fallback ToNodeFunc) (Node, error)
ToNode converts objects returned by schema-less encodings such as JSON to Node objects.
type Object ¶
Object is a representation of generic node with fields.
func (Object) CloneObject ¶
CloneObject clones this node only, without deep copy of field values.
func (Object) EqualObject ¶
func (Object) Native ¶
func (m Object) Native() interface{}
Native converts an object to a generic Go map type (map[string]interface{}).
type ToNodeFunc ¶
Directories ¶
Path | Synopsis |
---|---|
Package nodesproto is a generated protocol buffer package.
|
Package nodesproto is a generated protocol buffer package. |