Defines most of the public APIs. Functions transform raw providers into annotated provider objects.
Definition of provider
type. Helper functions for manipulating
providers and collections of providers
The provider
type is the internal structure that tracks everything to
do with an individual provider (function, constant, wrapper, etc) in
the chain. Different fields are filled in by different parts of the
code:
- api.go records user annotations
- characterize.go adds attributes related to how the provider is used including the input/output flows
- bind.go adds some additional notes used for creating the closure
- include.go keeps notes (like
include
) and generates the up/down and bypass maps. - generate.go adds per-provider closures (wrappers)
Classifies providers. This is done with a collection of predicates and mapping from predicate sets to provider classifications.
Orchestrates creating the closures of Bind()
. Run()
is implemnted
as a throw-away Bind()
.
Evaluate exactly which providers to include in the chain being created.
Generate a closure that evaluates the entire chain. This includes all of the wrapping required for the different kinds of providers.
Currently Reflect.Type is mapped to integers and the integers are used in place of Reflect.Type everywhere. Is this a good idea? Maybe, maybe not. Reglardless, type_codes is where it happens.
Constants for the different kinds of types and type classes. Definition of
the Debugging
type.
When types don't perfectly match, find the type that is closest. This is needed when a concrete type needs to used to fill a request for an interface.
Lookup values for Memoize() and Singleton() providers.
Handles struct filling and using Reflective types.
Debugging can be turned on/off at runtime with thread safety.
Custom error wrapper.