An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/facebookgo/inject

Package inject provides a reflect based injector. A large application built with dependency injection in mind will typically involve the boring work of setting up the object graph. This library attempts to take care of this boring work by creating and connecting the various objects. Its use involves you seeding the object graph with some (possibly incomplete) objects, where the underlying types have been tagged for injection. Given this, the library will populate the objects creating new ones as necessary. It uses singletons by default, supports optional private instances as well as named instances. It works using Go's reflection package and is inherently limited in what it can do as opposed to a code-gen system with respect to private fields. The usage pattern for the library involves struct tags. It requires the tag format used by the various standard libraries, like json, xml etc. It involves tags in one of the three forms below: The first no value syntax is for the common case of a singleton dependency of the associated type. The second triggers creation of a private instance for the associated type. Finally the last form is asking for a named dependency called "dev logger".

Ecosystem
proxy.golang.org
Latest Release
v0.0.0-20180706035515-f23751cae28b
over 7 years ago
Versions
2
Dependent Packages
95
Dependent Repos
301
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/facebookgo/inject
spec
License MIT
Namespace github.com/facebookgo
First Release almost 10 years ago
Last Synced 1 day ago
Repository
Stars 1,393 on GitHub
Forks 133 on GitHub
Docker Dependents 131
Docker Downloads 396,859,832
Rankings on proxy.golang.org
Overall Top 1.0%
Dependent packages Top 0.5%
Dependent repos Top 0.4%
Forks Top 2.3%
Docker downloads Top 0.2%