inject

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotImplementedError           = errors.New("[inject] interface is not implemented")
	InvalidObjectError            = errors.New("[inject] invalid object")
	UnsupportedInjectionTypeError = errors.New("[inject] unsupported injection type")
	IllegalArgumentError          = errors.New("[inject] input argument type can not be the same as receiver")
	TagIsAlreadyExistError        = errors.New("[inject] tag is already exist")
	TagIsNilError                 = errors.New("[inject] tag is nil")
	InvalidTagNameError           = errors.New("[inject] invalid tag name, e.g. exampleTag")
)

Functions

func AddTag added in v0.3.0

func AddTag(tag Tag) error

AddTag

func IntoObject

func IntoObject(object reflect.Value) error

IntoObject injects instance into the tagged field with `inject:"instanceName"`

Types

type BaseTag added in v0.3.0

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

func (*BaseTag) Decode added in v0.3.0

func (t *BaseTag) Decode(object reflect.Value, field reflect.StructField, tag string) (retVal interface{})

func (*BaseTag) IsSingleton added in v0.3.0

func (t *BaseTag) IsSingleton() bool

func (*BaseTag) ParseProperties added in v0.3.0

func (t *BaseTag) ParseProperties(tag string) map[string]interface{}

func (*BaseTag) Properties added in v0.3.0

func (t *BaseTag) Properties() map[string]interface{}

type Tag added in v0.3.0

type Tag interface {
	Decode(object reflect.Value, field reflect.StructField, tag string) (retVal interface{})
	Properties() map[string]interface{}
	IsSingleton() bool
}

Jump to

Keyboard shortcuts

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