【文件属性】:
文件名称:container
文件大小:5KB
文件格式:ZIP
更新时间:2021-03-09 17:55:47
golang ioc-container Go
IoC容器的golang工具
基本用法
package main
import (
"fmt"
"github.com/enorith/container"
"reflect"
)
type Foo struct {
name string
}
func main (){
c := container . New ()
// bind
c . BindFunc ( Foo {}, func ( c * container. Container ) reflect. Value {
return reflect . ValueOf ( Foo { "foo" })
}, false )
// get instance
v , _ := c . Instance ( Foo {})
fmt
【文件预览】:
container-master
----go.mod(89B)
----go.sum(173B)
----container.go(7KB)
----container_test.go(6KB)
----readme.md(759B)