Documentation
¶
Index ¶
- Constants
- type ConditionContext
- type Module
- type RefreshState
- type Resolving
- func (c *Resolving) AddMock(mock gs.BeanMock)
- func (c *Resolving) Beans() []*gs_bean.BeanDefinition
- func (c *Resolving) Module(conditions []gs_cond.ConditionOnProperty, fn func(p conf.Properties) error)
- func (c *Resolving) Object(i any) *gs.RegisteredBean
- func (c *Resolving) Provide(ctor any, args ...gs.Arg) *gs.RegisteredBean
- func (c *Resolving) Refresh(p conf.Properties) error
- func (c *Resolving) Register(b *gs.BeanDefinition) *gs.RegisteredBean
- func (c *Resolving) RootBean(b *gs.RegisteredBean)
- func (c *Resolving) Roots() []*gs_bean.BeanDefinition
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 provides condition evaluation context during resolution.
func (*ConditionContext) Find ¶ added in v1.2.3
func (c *ConditionContext) Find(s gs.BeanSelector) ([]gs.ConditionBean, error)
Find returns beans matching the selector after resolving their conditions.
func (*ConditionContext) Has ¶ added in v1.2.3
func (c *ConditionContext) Has(key string) bool
Has checks if a configuration property exists.
type Module ¶ added in v1.2.3
type Module struct {
// contains filtered or unexported fields
}
Module represents a module registered in the container.
type RefreshState ¶
type RefreshState int
RefreshState represents the current state of the container.
type Resolving ¶
type Resolving struct {
// contains filtered or unexported fields
}
Resolving manages bean definitions, mocks, and dynamic bean registration functions.
func (*Resolving) Beans ¶
func (c *Resolving) Beans() []*gs_bean.BeanDefinition
Beans returns all active bean definitions, excluding deleted ones.
func (*Resolving) Module ¶ added in v1.2.3
func (c *Resolving) Module(conditions []gs_cond.ConditionOnProperty, fn func(p conf.Properties) error)
Module registers a module into the container.
func (*Resolving) Object ¶
func (c *Resolving) Object(i any) *gs.RegisteredBean
Object registers a pre-constructed instance as a bean.
func (*Resolving) Refresh ¶
func (c *Resolving) Refresh(p conf.Properties) error
Refresh performs the full initialization process of the container. It transitions through several phases: - Executes group functions to register additional beans. - Scans configuration beans and registers their methods as beans. - Applies mock beans to override specific targets. - Resolves all beans based on their conditions. - Validates that no duplicate beans exist.
func (*Resolving) Register ¶
func (c *Resolving) Register(b *gs.BeanDefinition) *gs.RegisteredBean
Register adds a bean definition to the container.
func (*Resolving) RootBean ¶ added in v1.2.3
func (c *Resolving) RootBean(b *gs.RegisteredBean)
RootBean adds a root bean to the container.
func (*Resolving) Roots ¶ added in v1.2.3
func (c *Resolving) Roots() []*gs_bean.BeanDefinition
Roots returns all root beans.