fire_di

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: Apache-2.0 Imports: 8 Imported by: 1

README

Fire-di Framework

release GoDoc Go Report Card

自定义的依整注入框架

Installation (安装)

1. 下装并安装

a). 使用 "go get" 方式下载

$ go get -u github.com/1-bi/fire-di

b). 使用 "vgo" 方式下载

$ vgo get github.com/1-bi/fire-di
2. 引用代码
import di "github.com/1-bi/fire-di"

使用例子

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(conf *Configuration)

Config config the base inject environment

func CreateInjector

func CreateInjector(bs providerstore) (*injector, error)

CreateInjector create injecto for object

func FuncInterceptor

func FuncInterceptor(fptr interface{}, funIntercept func(in []reflect.Value) []reflect.Value) reflect.Value

FuncInterceptor define interceptor function handle

func RegisterModules

func RegisterModules(mods ...Module) providerstore

RegisterModules create function handle for beanCtx

Types

type AppCtx

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

AppCtx define the application context

func (*AppCtx) GetInstance

func (myself *AppCtx) GetInstance(from interface{}) (interface{}, error)

GetInstance the public instance for get application

type ApplicationContext

type ApplicationContext interface {

	// ---- get application method ----
	GetInstance(itypes ...interface{}) interface{}
}

ApplicationContext --- create application context ----

type BaseModuleContext

type BaseModuleContext struct {
	Provider *register
}

BaseModuleContext define beanCtx object

func (*BaseModuleContext) GetRegister

func (myself *BaseModuleContext) GetRegister() *register

GetRegister get base register define

type BeanCtxBinder

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

BeanCtxBinder defined appp store

func (*BeanCtxBinder) Bind

func (myself *BeanCtxBinder) Bind(froms ...interface{}) Builder

Bind ... bind all interface

func (*BeanCtxBinder) BindType

func (myself *BeanCtxBinder) BindType(froms ...interface{}) Builder

BindType bind type in builder

func (*BeanCtxBinder) String

func (myself *BeanCtxBinder) String() string

*

  • defined method binding
  • implement function for inject api

type Binder

type Binder interface {
	fmt.Stringer

	// ---- bind provided handler for hag -----
	Provide(handlers ...interface{}) error

	// ---- set register bean ---
	InjectBean(funcs interface{}) error

	// ---- bind invoke handler
	Invoke(handlers ...interface{}) error
}

Binder create beanCtx interface

type Builder

type Builder interface {
	// --- bind singleton object ----
	ToProxyInst(singleton reflect.Value)
}

Builder is the return value from a Bind call from a Module.

type Configuration

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

Configuration get the annotaion config

func (*Configuration) SetInjectMethodPrefix

func (myself *Configuration) SetInjectMethodPrefix(method ...string)

SetInjectMethodPrefix set inject method prefix

type CtxBinder

type CtxBinder interface {
	Bind(itypes ...interface{}) Builder
}

CtxBinder create application inject

type InjectAwaredSupport

type InjectAwaredSupport interface {

	// ProvideMethod defined provide method
	ProvideMethod() []interface{}
}

InjectAwaredSupport dev support api

type InjectObjInfoProxy

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

*

  • defin all project object interface

func (*InjectObjInfoProxy) GetAllDependency

func (myself *InjectObjInfoProxy) GetAllDependency() []string

type Injector

type Injector interface {

	/**
	 * create injector application
	 */
	Execute(funcs ...interface{}) error
}

Injector is setting for injecto ioc handle

type InterfaceBuilder

type InterfaceBuilder interface {
	Builder
}

InterfaceBuilder is the return value when binding an interface from a Module.

type Module

type Module interface {
	Bind(ctx ModuleContext)
}

Module define module interface

type ModuleContext

type ModuleContext interface {
	GetRegister() *register
}

ModuleContext define module context

type RegisterBean

type RegisterBean struct {
	// define base bean
	Bean       interface{}
	ProvideFun interface{}
}

RegisterBean define register bean

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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