Documentation ¶
Index ¶
- type Builder
- func (b *Builder) AttachChild(parent Reference, child Reference)
- func (b *Builder) Chain(from Reference, to Reference)
- func (b *Builder) NodeAt(ref Reference) *Node
- func (b *Builder) Push(n Node) Reference
- func (b *Builder) PushAndChain(n Node) Reference
- func (b *Builder) Reset()
- func (b *Builder) Tree() *Root
- type Iterator
- type Kind
- type Node
- type Range
- type Reference
- type Root
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) AttachChild ¶
func (*Builder) PushAndChain ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator starts uninitialized, you need to call Next() first.
For example:
it := n.Children() for it.Next() { it.Node() }
func (*Iterator) IsLast ¶
IsLast returns true if the current node of the iterator is the last one. Subsequent call to Next() will return false.
type Node ¶
type Node struct { Kind Kind Raw Range // Raw bytes from the input. Data []byte // Node value (either allocated or referencing the input). // contains filtered or unexported fields }
Arrays have one child per element in the array. InlineTables have one child per key-value pair in the table. KeyValues have at least two children. The first one is the value. The rest make a potentially dotted key. Table and Array table have one child per element of the key they represent (same as KeyValue, but without the last node being the value).
func (*Node) Child ¶
Child returns a copy of the first child node of this node. Other children can be accessed calling Next on the first child. Returns an invalid Node if there is none.
func (*Node) Key ¶
Key returns the child nodes making the Key on a supported node. Panics otherwise. They are guaranteed to be all be of the Kind Key. A simple key would return just one element.
func (*Node) Next ¶
Next returns a copy of the next node, or an invalid Node if there is no next node.