resolving

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RefreshDefault = RefreshState(iota)
	Refreshing
	Refreshed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BeanGroupFunc

type BeanGroupFunc func(p conf.Properties) ([]*gs.BeanDefinition, error)

BeanGroupFunc defines a function that dynamically registers beans based on configuration properties.

type CondContext

type CondContext struct {
	// contains filtered or unexported fields
}

CondContext provides condition evaluation context during resolution.

func (*CondContext) Find

func (c *CondContext) Find(s gs.BeanSelector) ([]gs.CondBean, error)

Find returns beans matching the selector after resolving their conditions.

func (*CondContext) Has

func (c *CondContext) Has(key string) bool

Has checks if a configuration property exists.

func (*CondContext) Prop

func (c *CondContext) Prop(key string, def ...string) string

Prop retrieves a configuration property with optional default value.

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 New

func New() *Resolving

New creates an empty Resolving instance.

func (*Resolving) AddMock

func (c *Resolving) AddMock(mock gs.BeanMock)

AddMock adds a mock bean to the container.

func (*Resolving) Beans

func (c *Resolving) Beans() []*gs_bean.BeanDefinition

Beans returns all active bean definitions, excluding deleted ones.

func (*Resolving) GroupRegister

func (c *Resolving) GroupRegister(fn BeanGroupFunc)

GroupRegister adds a function to dynamically register beans.

func (*Resolving) Object

func (c *Resolving) Object(i any) *gs.RegisteredBean

Object registers a pre-constructed instance as a bean.

func (*Resolving) Provide

func (c *Resolving) Provide(ctor any, args ...gs.Arg) *gs.RegisteredBean

Provide registers a constructor function to create 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL