Documentation ¶
Overview ¶
The options package includes some default option parsers for the requests package.
Index ¶
- Variables
- func Default(orig, value interface{}, fromRequest bool, optionValue string) (interface{}, error)
- func Immutable(orig, value interface{}, fromRequest bool, optionValue string) (interface{}, error)
- func Required(orig, value interface{}, fromRequest bool, optionValue string) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRequiredMissing = errors.New("Required value has nil input") ErrValueImmutable = errors.New("Value is immutable once set") )
Functions ¶
func Default ¶
Default is an option func that sets a default value for a field. If its value is non-empty, it will use the following logic to decide what to return:
If fromRequest is false, then the default will be returned if orig is equal to its zero value.
If fromRequest is true, then the default will be returned if value is nil.
In all other cases, value will be returned.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.