resolving

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
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.

func (*ConditionContext) Prop added in v1.2.3

func (c *ConditionContext) Prop(key string) (string, bool)

Prop returns the string value of the given configuration key. Returns (value, true) if the key exists, ("", false) otherwise.

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 New

func New() *Resolving

New creates an empty Resolving instance.

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

func (c *Resolving) Provide(objOrCtor any, args ...gs.Arg) *gs_bean.BeanDefinition

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

func (c *Resolving) Refresh(p flatten.Storage) error

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.

Jump to

Keyboard shortcuts

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