StateTreeNodeForPath returns the path to the StateTreeNode representing the path p.
(ctx context.Context, p *path.StateTreeNodeForPath, r *path.ResolveConfig)
| 108 | // StateTreeNodeForPath returns the path to the StateTreeNode representing the |
| 109 | // path p. |
| 110 | func StateTreeNodeForPath(ctx context.Context, p *path.StateTreeNodeForPath, r *path.ResolveConfig) (*path.StateTreeNode, error) { |
| 111 | boxed, err := database.Resolve(ctx, p.Tree.ID()) |
| 112 | if err != nil { |
| 113 | return nil, err |
| 114 | } |
| 115 | indices, err := stateTreeNodePath(ctx, boxed.(*stateTree), p.Member.Node()) |
| 116 | if err != nil { |
| 117 | return nil, err |
| 118 | } |
| 119 | return &path.StateTreeNode{ |
| 120 | Tree: p.Tree, |
| 121 | Indices: indices, |
| 122 | }, nil |
| 123 | } |
| 124 | |
| 125 | func stateTreeNode(ctx context.Context, tree *stateTree, p *path.StateTreeNode) (*service.StateTreeNode, error) { |
| 126 | node := tree.root |
no test coverage detected