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

Method applyPreProcessors

component/container.go:645–664  ·  view source on GitHub ↗

applyPreProcessors executes all registered PreProcessor hooks on the instance. Returns the processed object or an error.

(ctx context.Context, instance any)

Source from the content-addressed store, hash-verified

643// applyPreProcessors executes all registered PreProcessor hooks on the instance.
644// Returns the processed object or an error.
645func (d *DefaultContainer) applyPreProcessors(ctx context.Context, instance any) (any, error) {
646 d.muProcessors.RLock()
647 defer d.muProcessors.RUnlock()
648
649 for _, processor := range d.preProcessors {
650 result, err := processor.ProcessBeforeInit(ctx, instance)
651
652 if err != nil {
653 return nil, err
654 }
655
656 if result == nil {
657 return nil, errors.New("nil processor result")
658 }
659
660 instance = result
661 }
662
663 return instance, nil
664}
665
666// applyPostProcessors executes all registered PostProcessor hooks on the instance.
667// Returns the processed object or an error.

Callers 1

initializeMethod · 0.95

Calls 1

ProcessBeforeInitMethod · 0.65

Tested by

no test coverage detected