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

Method ResolveAll

component/container.go:405–425  ·  view source on GitHub ↗

ResolveAll retrieves all instances assignable to the specified type.

(ctx context.Context, typ reflect.Type)

Source from the content-addressed store, hash-verified

403
404// ResolveAll retrieves all instances assignable to the specified type.
405func (d *DefaultContainer) ResolveAll(ctx context.Context, typ reflect.Type) ([]any, error) {
406 if typ == nil {
407 return nil, errors.New("nil type")
408 }
409
410 ctx = withCreationState(ctx)
411
412 instances := d.findResolvableCandidates(typ)
413
414 for _, def := range d.DefinitionsOf(typ) {
415 instance, err := d.Resolve(ctx, def.Name())
416
417 if err != nil {
418 return nil, err
419 }
420
421 instances = append(instances, instance)
422 }
423
424 return instances, nil
425}
426
427// RegisterResolvable registers type with the corresponding value.
428func (d *DefaultContainer) RegisterResolvable(typ reflect.Type, instance any) error {

Callers 1

resolveArgumentsMethod · 0.95

Calls 5

DefinitionsOfMethod · 0.95
ResolveMethod · 0.95
withCreationStateFunction · 0.85
NameMethod · 0.65

Tested by

no test coverage detected