Documentation
¶
Index ¶
- Constants
- type Raw
- func (r Raw) Bool() (bool, error)
- func (r Raw) Duration() (time.Duration, error)
- func (r Raw) Float32() (float32, error)
- func (r Raw) Float64() (float64, error)
- func (r Raw) Int() (int, error)
- func (r Raw) Int8() (int8, error)
- func (r Raw) Int16() (int16, error)
- func (r Raw) Int32() (int32, error)
- func (r Raw) Int64() (int64, error)
- func (r Raw) String() string
- func (r Raw) Uint() (uint, error)
- func (r Raw) Uint8() (uint8, error)
- func (r Raw) Uint16() (uint16, error)
- func (r Raw) Uint32() (uint32, error)
- func (r Raw) Uint64() (uint64, error)
- type UnsupportedError
- type Value
Constants ¶
const ( ParseError errors.Kind = "parse error" ValidationError errors.Kind = "validation error" )
const ( ErrPointerExpected errors.Msg = "expected a pointer" Unsupported = "<unsupported>" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Raw ¶
type Raw string
Raw is a raw string representation of a primitive value.
func (Raw) Bool ¶
Bool tries to parse Raw as a bool with strconv.ParseBool and returns it and any errors that occur.
func (Raw) Duration ¶
Duration tries to parse Raw as time.Duration with time.ParseDuration and returns it and any errors that occur.
func (Raw) Float32 ¶
Float32 tries to parse Raw as a float32 with strconv.ParseFloat and returns it and any errors that occur.
func (Raw) Float64 ¶
Float64 tries to parse Raw as a float64 with strconv.ParseFloat and returns it and any errors that occur.
func (Raw) Int ¶
Int tries to parse Raw as an int with strconv.ParseInt and returns it and any errors that occur.
func (Raw) Int8 ¶
Int8 tries to parse Raw as an int8 with strconv.ParseInt and returns it and any errors that occur.
func (Raw) Int16 ¶
Int16 tries to parse Raw as an int16 with strconv.ParseInt and returns it and any errors that occur.
func (Raw) Int32 ¶
Int32 tries to parse Raw as an int32 with strconv.ParseInt and returns it and any errors that occur.
func (Raw) Int64 ¶
Int64 tries to parse Raw as an int64 with strconv.ParseInt and returns it and any errors that occur.
func (Raw) Uint ¶
Uint tries to parse Raw as an uint with strconv.ParseUint and returns it and any errors that occur.
func (Raw) Uint8 ¶
Uint8 tries to parse Raw as an uint8 with strconv.ParseUint and returns it and any errors that occur.
func (Raw) Uint16 ¶
Uint16 tries to parse Raw as an uint16 with strconv.ParseUint and returns it and any errors that occur.
type UnsupportedError ¶
func (*UnsupportedError) Error ¶
func (e *UnsupportedError) Error() string
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is a wrapper around reflect.Value. It is compatible with the flag.Value and flag.Getter interfaces.
func ValueOf ¶
ValueOf creates a Value of the provided pointer to a value. It returns an error with message ErrPointerExpected when ptr is not a pointer.
func (*Value) Get ¶
func (v *Value) Get() interface{}
Get returns Value's current value as an interface{}.
func (*Value) SetRaw ¶
SetRaw sets Value's underlying value by parsing Raw to Value's underlying reflect.Kind.