Categorygithub.com/xmidt-org/arrange
modulepackage
0.5.1
Repository: https://github.com/xmidt-org/arrange.git
Documentation: pkg.go.dev

# README

arrange

Arrange is a companion to fx that adds some standard, opinionated APIs for common dependency injection tasks. Refer to the godoc for more information and examples.

Build Status codecov.io Go Report Card Apache V2 License GitHub Release GoDoc

Summary

Arrange provides some additional utility for microservices built on fx. In particular, arrangehttp provides a lightly opinionated way to bootstrap clients and servers.

Table of Contents

Code of Conduct

This project and everyone participating in it are governed by the XMiDT Code Of Conduct. By participating, you agree to this Code.

Install

go get github.com/xmidt-org/arrange

Contributing

Refer to CONTRIBUTING.md.

# Packages

Package arrangehttp further extends the notion of unmarshaled components to the idea of building http servers and clients from configuration.
Package arrangepprof enables pprof functionality bound to an fx.App instance.
Package arrangetest contains useful unit test utilities for working with dependency injection and client/server lifecycle.
Package arrangetls has basic unmarshaling and external configuration support for HTTP clients and servers created within an uber/fx App.

# Functions

ExitCodeFor provides a standard way of determining the exit code associated with an error.
If returns a non-nil Conditional if its sole argument is true.
IfNot is the boolean inverse of If.
ShutdownWhenDone executes a context-less task and ensures that the enclosing fx.App is shutdown when the task is complete.
ShutdownWhenDoneCtx executes a context-based task and ensures that the enclosing fx.App is shutdown when the task is complete.
Tags starts a Fluent Builder chain for creating a sequence of tags.
UseExitCode returns a new error object that associates an existing error with an exit code.

# Constants

DefaultErrorExitCode is used when no exit code could otherwise be determined for a non-nil error.

# Structs

Conditional is a simple strategy for emitting options into an fx.App container.
TagBuilder is a Fluent Builder for creating sequences of fx struct tags in various situations.

# Interfaces

ExitCoder is an optional interface that an error can implement to supply an associated exit code with that error.
Task is the type that any context-less operation must conform to.
TaskCtx is the type that any operation that requires a context must conform to.

# Type aliases

ErrorCoder is a strategy type for determining the exit code for an error.