package options
import "github.com/docker/libnetwork/options"
Package options provides a way to pass unstructured sets of options to a component expecting a strongly-typed configuration structure.
Index ¶
- func GenerateFromModel(options Generic, model interface{}) (interface{}, error)
- type CannotSetFieldError
- type Generic
- type NoSuchFieldError
- type TypeMismatchError
Functions ¶
func GenerateFromModel ¶
GenerateFromModel takes the generic options, and tries to build a new instance of the model's type by matching keys from the generic options to fields in the model.
The return value is of the same type than the model (including a potential pointer qualifier).
Types ¶
type CannotSetFieldError ¶
CannotSetFieldError is the error returned when the generic parameters hold a value for a field that cannot be set in the destination structure.
func (CannotSetFieldError) Error ¶
func (e CannotSetFieldError) Error() string
type Generic ¶
type Generic map[string]interface{}
Generic is an basic type to store arbitrary settings.
func NewGeneric ¶
func NewGeneric() Generic
NewGeneric returns a new Generic instance.
type NoSuchFieldError ¶
NoSuchFieldError is the error returned when the generic parameters hold a value for a field absent from the destination structure.
func (NoSuchFieldError) Error ¶
func (e NoSuchFieldError) Error() string
type TypeMismatchError ¶
TypeMismatchError is the error returned when the type of the generic value for a field mismatches the type of the destination structure.
func (TypeMismatchError) Error ¶
func (e TypeMismatchError) Error() string
Source Files ¶
- Version
- v0.5.6 (latest)
- Published
- Jan 15, 2016
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 2 hours ago –
Tools for package owners.