Documentation
¶
Overview ¶
Package inject contains code for working with Injectors.
Index ¶
- type ArrayMaker
- type BoolMaker
- type ChanMaker
- type ComplexMaker
- type FloatMaker
- type FuncMaker
- type Injector
- type InjectorFunc
- type IntMaker
- type InterfaceMaker
- type MapMaker
- type PtrMaker
- type SliceMaker
- type StringMaker
- type StructMaker
- type UintMaker
- type UintPtrMaker
- type UnsafePointerMaker
- type UnsupportedKindError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayMaker ¶
type ComplexMaker ¶
type ComplexMaker interface {
// Makes a complex value with the given bitSize based on the input string.
// Returning false indicates no value was made.
MakeComplex(s string, bitSize int) (bool, complex128, error)
}
type FloatMaker ¶
type Injector ¶
type Injector interface {
// May set a value based on string.
// Returns (true, nil) when a value has been set, or (false, nil) when a value has not been set (e.g. environment
// variable not set, file not found, etc.).
Inject(reflect.Value, string) (bool, error)
}
An Injector sets a value based on a string.
func TypedInjector ¶
func TypedInjector(valueMaker interface{}) Injector
TypedInjector returns an Injector utilizing valueMaker, which should implement one or more *Maker interfaces.
type InjectorFunc ¶
InjectorFunc implements Injector.
type InterfaceMaker ¶
type SliceMaker ¶
type StringMaker ¶
type StructMaker ¶
type UintPtrMaker ¶
type UnsafePointerMaker ¶
type UnsupportedKindError ¶
An UnsupportedKindError indicates that a value maker does not support a certain reflect.Kind.
func (*UnsupportedKindError) Error ¶
func (e *UnsupportedKindError) Error() string
Directories
¶
| Path | Synopsis |
|---|---|
|
Package env provides a inject.Injector to set values from environment variables.
|
Package env provides a inject.Injector to set values from environment variables. |
|
Package file provides an inject.Injector for file input.
|
Package file provides an inject.Injector for file input. |
|
Package flag provides an inject.Injector to set values from command line flags.
|
Package flag provides an inject.Injector to set values from command line flags. |
|
Package literal provides an inject.Injector that parses string literals into values.
|
Package literal provides an inject.Injector that parses string literals into values. |
Click to show internal directories.
Click to hide internal directories.