# README
:unicorn: Fx

An application framework for Go that:
- Makes dependency injection easy.
- Eliminates the need for global state and
func init()
.
Installation
We recommend locking to SemVer range ^1
using Glide:
glide get 'go.uber.org/fx#^1'
Alternatively you can add it as a dependency using go mod:
go get go.uber.org/fx@v1
Or by using dep:
dep ensure -add go.uber.org/[email protected]
Stability
This library is v1
and follows SemVer strictly.
No breaking changes will be made to exported APIs before v2.0.0
.
This project follows the Go Release Policy. Each major version of Go is supported until there are two newer major releases.
# Packages
No description provided by the author
# Functions
Error registers any number of errors with the application to short-circuit startup.
ErrorHook registers error handlers that implement error handling functions.
Extract fills the given struct with values from the dependency injection container on application initialization.
Invoke registers functions that are executed eagerly on application start.
Logger redirects the application's log output to the provided printer.
New creates and initializes an App, immediately executing any functions registered via Invoke options.
Options converts a collection of Options into a single Option.
Populate sets targets with values from the dependency injection container during application initialization.
Provide registers any number of constructor functions, teaching the application how to instantiate various types.
StartTimeout changes the application's start timeout.
StopTimeout changes the application's stop timeout.
Supply provides instantiated values for dependency injection as if they had been provided using a constructor that simply returns them.
ValidateApp validates that supplied graph would run and is not missing any dependencies.
VisualizeError returns the visualization of the error if available.
# Constants
DefaultTimeout is the default timeout for starting or stopping an application.
Version is exported for runtime compatibility checks.
# Variables
NopLogger disables the application's log output.
# Structs
Annotated annotates a constructor provided to Fx with additional options.
An App is a modular application built around dependency injection.
A Hook is a pair of start and stop callbacks, either of which can be nil.
In can be embedded in a constructor's parameter struct to take advantage of advanced dependency injection features.
Out is the inverse of In: it can be embedded in result structs to take advantage of advanced features.
# Interfaces
ErrorHandler handles Fx application startup errors.
Lifecycle allows constructors to register callbacks that are executed on application start and stop.
An Option configures an App using the functional options paradigm popularized by Rob Pike.
Printer is the interface required by Fx's logging backend.
Shutdowner provides a method that can manually trigger the shutdown of the application by sending a signal to all open Done channels.
ShutdownOption provides a way to configure properties of the shutdown process.
# Type aliases
DotGraph contains a DOT language visualization of the dependency graph in an Fx application.