digo:Golang 的依赖注入器

时间:2021-06-11 00:11:55
【文件属性】:
文件名称:digo:Golang 的依赖注入器
文件大小:11KB
文件格式:ZIP
更新时间:2021-06-11 00:11:55
Go 迪戈 ###Go 的依赖注入 Digo 的灵感来自 Java 的 Spring 框架允许使用配置文件进行依赖注入的方式。 不同之处在于 digo 使用 Json 而不是 XML,并且由于语言限制,必须注册类型。 还有其他不使用反射的 DI 库, 就是一个很好的例子。 ##安装 使用以下命令下载存储库: go get github.com/cone/digo 然后将项目包含在您的项目中,如下所示: import "github.com/cone/digo" ##它能做什么 Digo 允许使用配置文件进行依赖注入。 让我们假设我们有 ProductController 结构如下: type ProductController struct{ DB Repository Validator DataValidator } ProductController有 2
【文件预览】:
digo-master
----injector.go(2KB)
----.gitignore(288B)
----digo_test.go(730B)
----type_map_test.go(1KB)
----helpers_test.go(824B)
----context_manager.go(963B)
----.travis.yml(45B)
----node_data.go(254B)
----test-data()
--------test.json(398B)
----LICENSE(1KB)
----type_registry.go(112B)
----context_test.go(1KB)
----injector_test.go(846B)
----initializer.go(67B)
----README.md(7KB)
----context.go(2KB)
----digo.go(233B)
----type_map.go(526B)

网友评论