forked from autom8ter/dagger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_test.go
More file actions
44 lines (42 loc) · 883 Bytes
/
example_test.go
File metadata and controls
44 lines (42 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package dagger_test
import (
"fmt"
"github.com/autom8ter/dagger"
)
func ExampleGraph_SetNode() {
var g = dagger.NewGraph()
g.SetNode(dagger.Path{
XID: "virtual_machine_1",
XType: "infra",
}, map[string]interface{}{})
g.SetNode(dagger.Path{
XID: "virtual_machine_2",
XType: "infra",
}, map[string]interface{}{})
g.SetNode(dagger.Path{
XID: "kubernetes",
XType: "infra",
}, map[string]interface{}{})
g.SetNode(dagger.Path{
XID: "redis",
XType: "infra",
}, map[string]interface{}{
"port": "6379",
})
g.SetNode(dagger.Path{
XID: "mongo",
XType: "infra",
}, map[string]interface{}{
"port": "5568",
})
g.SetNode(dagger.Path{
XID: "http",
XType: "infra",
}, map[string]interface{}{
"port": "8080",
})
g.RangeNodes("*", func(n dagger.Node) bool {
fmt.Printf("found node in graph: %s.%s\n", n.XType, n.XID)
return true
})
}