Documentation
¶
Index ¶
Constants ¶
const ( RefreshDefault = RefreshState(iota) RefreshPrepare Refreshing Refreshed )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConditionContext ¶ added in v1.2.3
type ConditionContext struct {
// contains filtered or unexported fields
}
ConditionContext represents the context for evaluating bean conditions.
func (*ConditionContext) Find ¶ added in v1.2.3
func (c *ConditionContext) Find(beanID gs.BeanID) ([]gs.ConditionBean, error)
Find searches for all active beans matching the given BeanID (type and/or name). - Skips beans that are resolving or deleted. - Calls resolveBean to ensure each matching bean still satisfies its conditions. Returns a slice of ConditionBean and an error if any resolution fails.
func (*ConditionContext) Has ¶ added in v1.2.3
func (c *ConditionContext) Has(key string) bool
Has returns true if the given configuration key exists in the storage.
type RefreshState ¶
type RefreshState int
RefreshState represents the current state of the container.
type Resolving ¶
type Resolving struct {
// contains filtered or unexported fields
}
Resolving is the core container managing BeanDefinitions. It supports registering beans, applying modules, scanning configuration beans, resolving conditional beans, and checking for duplicates.
func (*Resolving) Beans ¶
func (c *Resolving) Beans() []*gs_bean.BeanDefinition
Beans returns all bean definitions that are not marked as deleted (StatusDeleted).
func (*Resolving) Provide ¶
Provide registers a new bean definition in the container. - objOrCtor can be an existing instance or a constructor function. - Panics if the container is already Refreshing or Refreshed. - Returns the BeanDefinition with caller information populated.
func (*Resolving) Refresh ¶
Refresh performs the full container initialization lifecycle. Steps: 1. Merge globally registered beans and container beans. 2. Apply registered modules that satisfy their conditions. 3. Set the container state to Refreshing. 4. Scan configuration beans and register eligible methods as beans. 5. Resolve all beans against their conditions, marking inactive ones as deleted. 6. Check for duplicate beans by type and name. 7. Set the container state to Refreshed.