github.com/chalford/terraform@v0.3.7-0.20150113080010-a78c69a8c81f/depgraph/noun.go (about) 1 package depgraph 2 3 import ( 4 "fmt" 5 6 "github.com/hashicorp/terraform/digraph" 7 ) 8 9 // Nouns are the key structure of the dependency graph. They can 10 // be used to represent all objects in the graph. They are linked 11 // by depedencies. 12 type Noun struct { 13 Name string // Opaque name 14 Meta interface{} 15 Deps []*Dependency 16 } 17 18 // Edges returns the out-going edges of a Noun 19 func (n *Noun) Edges() []digraph.Edge { 20 edges := make([]digraph.Edge, len(n.Deps)) 21 for idx, dep := range n.Deps { 22 edges[idx] = dep 23 } 24 return edges 25 } 26 27 func (n *Noun) GoString() string { 28 return fmt.Sprintf("*%#v", *n) 29 } 30 31 func (n *Noun) String() string { 32 return n.Name 33 }