MCPcopy Create free account
hub / github.com/codnect/procyon / DefinitionsOf

Method DefinitionsOf

component/container.go:177–191  ·  view source on GitHub ↗

DefinitionsOf returns a slice of component definitions that are assignable to the specified type.

(typ reflect.Type)

Source from the content-addressed store, hash-verified

175
176// DefinitionsOf returns a slice of component definitions that are assignable to the specified type.
177func (d *DefaultContainer) DefinitionsOf(typ reflect.Type) []*Definition {
178 muComponents.RLock()
179 defer muComponents.RUnlock()
180
181 matches := make([]*Definition, 0)
182
183 for _, def := range d.definitions {
184 sourceType := def.Type()
185 if convertibleTo(sourceType, typ) {
186 matches = append(matches, def)
187 }
188 }
189
190 return matches
191}
192
193// RegisterSingleton registers a singleton instance with the given name.
194// Returns an error if a singleton with the same name already exists.

Callers 3

ResolveTypeMethod · 0.95
ResolveAllMethod · 0.95

Calls 2

convertibleToFunction · 0.85
TypeMethod · 0.45

Tested by 1