Cleanup record encoding logic, add tests
This commit is contained in:
@@ -312,6 +312,17 @@ func (g DepGraph) ChildrenForResourceType(n *Node, rt string) (out NodeSet) {
|
||||
return
|
||||
}
|
||||
|
||||
func (g DepGraph) NodeForRef(ref Ref) (out *Node) {
|
||||
aux := make([]*Node, 0, 10)
|
||||
for _, sg := range g.graphs {
|
||||
for _, n := range sg.nodes {
|
||||
aux = append(aux, n.Node)
|
||||
}
|
||||
}
|
||||
|
||||
return NodeForRef(ref, aux...)
|
||||
}
|
||||
|
||||
// Children returns all child nodes of n
|
||||
func (g DepGraph) Children(n *Node) (out NodeSet) {
|
||||
for _, sg := range g.graphs {
|
||||
|
||||
@@ -30,6 +30,9 @@ type (
|
||||
|
||||
// Children returns all of the children of the provided node
|
||||
Children(*Node) NodeSet
|
||||
|
||||
// NodeForRef returns the node which matches the provided ref
|
||||
NodeForRef(Ref) *Node
|
||||
}
|
||||
|
||||
Preparer interface {
|
||||
@@ -77,6 +80,7 @@ type (
|
||||
Encoder EncoderConfig
|
||||
}
|
||||
EncoderConfig struct {
|
||||
DefaultUserID uint64
|
||||
PreferredTimeLayout string
|
||||
PreferredTimezone string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user