Documentation ¶
Index ¶
- type Node
- func NewNode() *Node
- func NewNodeFromFile(name string) (*Node, error)
- func NewNodeFromJSON(data []byte) (*Node, error)
- func NewNodeFromStream(r io.Reader) (*Node, error)
- func NewNodeWithData(data any) *Node
- func NewNodeWithDataAndName(data any, name string) *Node
- func NewNodeWithName(name string) *Node
- func NewNodeWithNameAndData(name string, data any) *Node
- func (n *Node) AddKid(kid *Node) bool
- func (n *Node) Data(data ...any) any
- func (n *Node) Depth() int
- func (n *Node) Destroy()
- func (n *Node) Detach() bool
- func (n *Node) Index() int
- func (n *Node) IsMapLike() bool
- func (n *Node) Kid(index int) *Node
- func (n *Node) KidByName(name string, recurse ...bool) *Node
- func (n *Node) Kids() []*Node
- func (n *Node) Len() int
- func (n *Node) MarshalJSON() ([]byte, error)
- func (n *Node) Name(name ...string) string
- func (n *Node) NewKid() *Node
- func (n *Node) NewKidWithData(data any) *Node
- func (n *Node) NewKidWithDataAndName(data any, name string) *Node
- func (n *Node) NewKidWithName(name string) *Node
- func (n *Node) NewKidWithNameAndData(name string, data any) *Node
- func (n *Node) Parent(parent ...*Node) *Node
- func (n *Node) RemoveAllKids()
- func (n *Node) RemoveKid(index int) bool
- func (n *Node) Root() *Node
- func (n *Node) ToMap() any
- func (n *Node) UnmarshalJSON(pay []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func NewNodeFromFile ¶
func NewNodeFromJSON ¶
func NewNodeWithData ¶
func NewNodeWithDataAndName ¶
func NewNodeWithName ¶
func NewNodeWithNameAndData ¶
func (*Node) IsMapLike ¶
Checks if the children of this node are better represented as a map or an array
This is determined by:
* Totaling number of children without names
* Comparing the percent of children without names to total children (if less than 50% use a map, if more than 50% use an array)
func (*Node) MarshalJSON ¶
Marshals the results from ToMap
func (*Node) NewKidWithData ¶
func (*Node) NewKidWithDataAndName ¶
func (*Node) NewKidWithName ¶
func (*Node) NewKidWithNameAndData ¶
func (*Node) RemoveAllKids ¶
func (n *Node) RemoveAllKids()
Click to show internal directories.
Click to hide internal directories.