applyPreProcessors executes all registered PreProcessor hooks on the instance. Returns the processed object or an error.
(ctx context.Context, instance any)
| 643 | // applyPreProcessors executes all registered PreProcessor hooks on the instance. |
| 644 | // Returns the processed object or an error. |
| 645 | func (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. |
no test coverage detected