gs_init

package
v1.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBean

func AddBean(bean *gs_bean.BeanDefinition)

AddBean registers a new bean definition in the global registry.

func AddModule

func AddModule(c gs_cond.PropertyCondition, fn ModuleFunc, file string, line int)

AddModule registers a new module function along with its activation conditions. The module will only be applied if the conditions are satisfied.

func Beans

func Beans() []*gs_bean.BeanDefinition

Beans returns all registered beans. In test mode, it returns cloned BeanDefinitions to avoid mutating shared bean definitions.

func Clear

func Clear()

Clear resets all registered beans and modules, effectively emptying the global registry.

Types

type BeanProvider

type BeanProvider interface {
	Provide(objOrCtor any, args ...gs.Arg) *gs_bean.BeanDefinition
}

BeanProvider defines the API for registering beans in the IoC container.

type Module

type Module struct {
	ModuleFunc ModuleFunc
	Condition  gs.Condition
	FileLine   string
}

Module represents a conditional module that can register beans when its Condition is satisfied.

func Modules

func Modules() []Module

Modules returns all registered modules.

type ModuleFunc

type ModuleFunc func(r BeanProvider, p flatten.Storage) error

ModuleFunc defines the signature of a module function that registers beans using a BeanProvider. The function receives a set of configuration properties as input.

Jump to

Keyboard shortcuts

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