ioc

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

itea-ioc

Documentation

Index

Constants

View Source
const (
	WIRED = "wired"
	VALUE = "value"
)
View Source
const (
	SINGLETON = "singleton"
	CONSTRUCT = "Construct"
	INIT      = "Init"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppendOption

type AppendOption func(*Ioc)

type Bean

type Bean struct {

	//name of bean, use for get instance by name
	Name string

	//singleton or prototype
	Scope string

	//abstract type of bean
	Abstract interface{}

	//concrete type of bean
	Concrete interface{}

	//construct function of instance
	//execute when instance be build
	Construct string

	//function execute after instance be build
	InitFunc string
	// contains filtered or unexported fields
}

func (*Bean) GetAbstractType

func (b *Bean) GetAbstractType() reflect.Type

func (*Bean) GetConcreteType

func (b *Bean) GetConcreteType() reflect.Type

func (*Bean) SetAbstractType

func (b *Bean) SetAbstractType(t reflect.Type)

func (*Bean) SetConcreteType

func (b *Bean) SetConcreteType(t reflect.Type)

type Builder

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

type Container

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

type IBuilder

type IBuilder interface {
	// contains filtered or unexported methods
}

func DefaultBuilder

func DefaultBuilder() IBuilder

type IOption

type IOption interface {
	// contains filtered or unexported methods
}

func WithConfig

func WithConfig(c *config.Config) IOption

With config to enable constant inject

type Ioc

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

func New

func New(opt ...IOption) *Ioc

func (*Ioc) Instance

func (i *Ioc) Instance(t interface{}) interface{}

Get instance of t Param t maybe class or name(string) of class

func (*Ioc) Register

func (i *Ioc) Register(b interface{})

Register class into ioc container for make instance Param b maybe class or instance of ioc.Bean

Jump to

Keyboard shortcuts

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