Skip to content

GrayDragon82/dependencies1

Repository files navigation

simple_di

A small, dependency-management library for Go that supports deferred initialization, ordered initialization (topological ordering) and two resolution modes:

  • named dependencies — register dependencies by a user-provided name and refer to other dependencies by name.
  • typed dependencies — register dependencies by Go type and automatically reduce them into structs using reflection and generics.

This library is intentionally small and zero-dependency — it focuses on simple dependency orchestration, deferred initialization (via Init) and safe shutdown (Close).


Features

  • Register dependencies (as Dependency wrappers), not raw objects — allows deferred initialization and deterministic init order based on declared references.
  • Named and typed dependency implementations (NamedDependency, TypedDependency).
  • Topological sorting with cycle detection for safe Init() ordering.
  • ReduceDependencies / MustReduceDependencies helpers to assemble typed structs from registered dependencies.
  • Small and test-covered.

Installation

go get github.com/GrayDragon82/dependency1

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages