Documentation ¶
Index ¶
- func TopologicalSort(vertices []*vertex.Vertex) ([]*vertex.Vertex, error)
- type Graph
- func (g *Graph) AddGlobalProvider(providedID string, val reflect.Value)
- func (g *Graph) AddInterfaceDep(vertex *vertex.Vertex, depID string, method Kind, isRef bool) error
- func (g *Graph) AddStructureDep(vertex *vertex.Vertex, depID string, method Kind, isRef bool) error
- func (g *Graph) AddVertex(vertexID string, vertexIface any)
- func (g *Graph) ClearState()
- func (g *Graph) FindProviders(depID string) *vertex.Vertex
- func (g *Graph) GetVertex(id string) *vertex.Vertex
- func (g *Graph) HasVertex(name string) bool
- func (g *Graph) Reset(vrtx *vertex.Vertex) []*vertex.Vertex
- type Kind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Graph ¶
type Graph struct { // Map with vertices to have an easy access to it VerticesMap map[string]*vertex.Vertex // List of all Vertices Vertices []*vertex.Vertex Providers map[string]reflect.Value // internal type InitialProviders map[string]reflect.Value }
Graph manages the set of services and their edges type of the VerticesMap: directed
func NewGraph ¶
func NewGraph() *Graph
NewGraph initializes endure Graph According to the topological sorting, graph should be 1. DIRECTED 2. ACYCLIC
func (*Graph) AddGlobalProvider ¶
AddGlobalProvider adds provider to the global map in the Graph structure
func (*Graph) AddInterfaceDep ¶
AddInterfaceDep doing the following: 1. Get a vertexID (foo2.S2 for example) 2. Get a depID --> could be vertexID of vertex dep ID like foo2.DB 3. Need to find vertexID to provide dependency. Example foo2.DB is actually foo2.S2 vertex
func (*Graph) AddStructureDep ¶
func (*Graph) AddVertex ¶
AddVertex adds an vertex to the graph with its ID, value and meta information
func (*Graph) ClearState ¶
func (g *Graph) ClearState()
func (*Graph) FindProviders ¶
FindProviders finds provider deps for the vertex and returns dependent vertices