Documentation ¶
Index ¶
- type Node
- func (n *Node) InferPtr() reflect.Value
- func (n *Node) Kind() reflect.Kind
- func (n *Node) NodeID(typeIDGen func(reflect.Type) string) NodeID
- func (n *Node) RegisterChild(node *Node, typeIDGen func(reflect.Type) string) bool
- func (n *Node) ResolveObj() interface{}
- func (n *Node) Value() reflect.Value
- type NodeID
- type Scanner
- func (s *Scanner) Maps() map[NodeID]map[NodeID]NodeID
- func (s *Scanner) Node(id NodeID) *Node
- func (s *Scanner) Nodes() map[NodeID]*Node
- func (s *Scanner) Scan(objs ...interface{}) <-chan NodeID
- func (s *Scanner) WithFilter(filter func(*Node) bool) *Scanner
- func (s *Scanner) WithParallism(p int) *Scanner
- func (s *Scanner) WithTerminal(terminal func(*Node) bool) *Scanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { // Children is the set of children nodes of the golang object Children map[NodeID]*Node // Fields is for structed object, field name will be mapped to a node ID Fields map[string]NodeID // Array is for array object, retains the order information for children Array []NodeID // contains filtered or unexported fields }
Node stores the information for a specific golang object
func (*Node) InferPtr ¶
InferPtr returns the object being pointed by this pointer node will panic if the node is not a pointer
func (*Node) RegisterChild ¶
RegisterChild returns true if successfully register child node return false if the child has already been registered
func (*Node) ResolveObj ¶
func (n *Node) ResolveObj() interface{}
ResolveObj returns the reference of the original object
type NodeID ¶
type NodeID struct {
// contains filtered or unexported fields
}
NodeID is used to uniquely identify a node
func (*NodeID) Hash ¶
Hash returns the hash version of NodeID identifier It supposed to be unique among for each node ID
func (*NodeID) IsPrimitive ¶
IsPrimitive returns true if the id is of a primitive type
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner stores the global object scan results
func NewScanner ¶
NewScanner instantiates a default Scanner instance
func (*Scanner) Scan ¶
Scan starts the object decomposition process. It's a non-blocking operation. It will return a channel of node IDs and consumer can listen on the channel. When all nodes are sent over the channel, it will be closed.
func (*Scanner) WithFilter ¶
WithFilter appends a filter for Node filtering User should NOT modify the object, and it's user's concern to keep the objects untouched.
func (*Scanner) WithParallism ¶
WithParallism configures the number of goroutines running in parallel effectively it's controlling the channel buffer size by default it's processed in serial