Documentation ¶
Index ¶
- Constants
- Variables
- func AutoWire(self any) error
- func Find[T any]() *T
- func FindByName[T any](name string) *T
- func Get[T any]() *T
- func NamedSingleton[T any](name string) *singleton[T]
- func New[T any]() *T
- func NewWithOption[T any](option *Option) *T
- func Put[T any](t *T)
- func Range[T any](rangeFunc func(any) bool)
- func RangeInterface[T any](interfaceFunc func(T) bool)
- func RangeStruct[T any](structFunc func(*T) bool)
- func SetPoolInit[T any](option *Option)
- func Singleton[T any]() *singleton[T]
- type Error
- type Getter
- type Option
- type TagValue
- type WireValue
Constants ¶
const DefaultInitMethodName = "Init"
DefaultInitMethodName is a constant representing the default name of the initialization method. It is used in the NewWithOption function to determine the name of the method to invoke during initialization. If the 'initMethodName' field in the Option struct is empty, the DefaultInitMethodName is used. If the 'useConstructor' field in the Option struct is true, the DefaultInitMethodName is set to the name of the struct. The DefaultInitMethodName is used in reflection to find and invoke the initialization method.
const ValueTag = "value"
ValueTag is a shortcut of wire:"value:"
const WireTag = "wire"
WireTag is a constant that defines the annotation string used for wire injection in Go code.
Variables ¶
var ErrInvalidWireValue = errors.New("not a valid WireValue")
Functions ¶
func FindByName ¶
func NamedSingleton ¶
func NewWithOption ¶
func RangeInterface ¶
func RangeStruct ¶
func SetPoolInit ¶
Types ¶
type Error ¶
type Error struct {
Errors []string
}
copied from github.com/mitchellh/mapstructure Error implements the error interface and can represents multiple errors that occur in the course of a single Decode.
func (*Error) WrappedErrors ¶
WrappedErrors implements the errwrap.Wrapper interface to make this return value more useful with the errwrap and go-multierror libraries.
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
func (*Option) InitMethodName ¶
func (*Option) InitParams ¶
func (*Option) UseConstructor ¶
type TagValue ¶
func ParseTagValue ¶
type WireValue ¶
type WireValue string
WireValue is an enum @EnumConfig(marshal, values, noComments, noCase) @Enum{self, auto, type, name, value}
func ParseWireValue ¶
func WireValueValues ¶
func WireValueValues() []WireValue