NewConditionalLoader creates a ConditionalLoader with the given container and components.
(container Container, components []*Component)
| 37 | |
| 38 | // NewConditionalLoader creates a ConditionalLoader with the given container and components. |
| 39 | func NewConditionalLoader(container Container, components []*Component) *ConditionalLoader { |
| 40 | if container == nil { |
| 41 | panic("nil container") |
| 42 | } |
| 43 | |
| 44 | return &ConditionalLoader{ |
| 45 | container: container, |
| 46 | components: components, |
| 47 | evaluator: newConditionEvaluator(container), |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // Load evaluates the conditions of each component and registers its definition into the container |
| 52 | // only if all conditions are satisfied. Components that fail condition checks are skipped. |