Ecosyste.ms: Packages

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

Top 10.0% on proxy.golang.org
Top 4.7% dependent repos on proxy.golang.org

proxy.golang.org : github.com/alecthomas/inject

Package inject provides dependency injection for Go. For small Go applications, manually constructing all required objects is more than sufficient. But for large, modular code bases, dependency injection can alleviate a lot of boilerplate. The following example illustrates a simple modular application. First, the main package installs configured modules and calls an entry point: Next we have a simple Mongo module with a configurable URI: The logging package shows idiomatic use of inject; it is just a thin wrapper around normal Go constructors. This is the least invasive way of using injection, and preferred. Two interfaces to the injector are provided: SafeInjector and Injector. The former will return error values and the latter will panic on any error. The latter is commonly used because DI failures are typically not user-recoverable. See the [README](https://github.com/alecthomas/inject/blob/master/README.md) for more details.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/alecthomas/inject
Keywords: dependency-injection, go, injection
License: MIT
Latest release: about 6 years ago
First release: about 6 years ago
Namespace: github.com/alecthomas
Dependent repositories: 1
Stars: 28 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 7 days ago

    Loading...
    Readme
    Loading...