node

package
v0.0.0-...-b18a026 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExported

func IsExported(rField *reflect.StructField) bool

IsExported checks whether field is exported..

func IsIgnored

func IsIgnored(rField *reflect.StructField, tagName string) bool

IsIgnored checks whether field is ignored..

func IsSupportedType

func IsSupportedType(rType reflect.Type) bool

IsSupportedType checks whether type is supported.

Types

type EncoderOption

type EncoderOption struct {
	TagName        string
	TagDescription string
}

EncoderOption defines option for encoder.

type FlattenMap

type FlattenMap interface {
	Value(key string) (value string, ok bool)
	ChildrenByPrefix(prefix string) []string
}

FlattenMap provides data to fill a node.

type Node

type Node struct {
	Key         string
	Name        string
	Description string
	FiledName   string
	Value       reflect.Value
	Children    []*Node
}

Node defines struct for a field in struct.

func New

func New(element interface{}, option EncoderOption) (*Node, error)

New encodes element into node.

func (*Node) FillNode

func (node *Node) FillNode(flattenMap FlattenMap) error

FillNode fills data into node.

func (*Node) Flat

func (node *Node) Flat() []*Node

Flat gets slice of all nodes sorted by name.

func (*Node) SerializeValue

func (node *Node) SerializeValue() string

SerializeValue serializes node's value.

func (*Node) Walk

func (node *Node) Walk(callback WalkCallback) error

Walk walks through node and all children.

type WalkCallback

type WalkCallback func(*Node) error

WalkCallback defines function called when walk.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL