Documentation ¶
Index ¶
- func Bool(from interface{}) (bool, error)
- func Duration(from interface{}) (time.Duration, error)
- func Float32(from interface{}) (float32, error)
- func Float64(from interface{}) (float64, error)
- func Infer(into, from interface{}) error
- func Int(from interface{}) (int, error)
- func Int16(from interface{}) (int16, error)
- func Int32(from interface{}) (int32, error)
- func Int64(from interface{}) (int64, error)
- func Int8(from interface{}) (int8, error)
- func String(from interface{}) (string, error)
- func Time(from interface{}) (time.Time, error)
- func Uint(from interface{}) (uint, error)
- func Uint16(from interface{}) (uint16, error)
- func Uint32(from interface{}) (uint32, error)
- func Uint64(from interface{}) (uint64, error)
- func Uint8(from interface{}) (uint8, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool will convert the given value to a bool, returns the default value of false if a conversion can not be made.
func Duration ¶
Duration will convert the given value to a time.Duration, returns the default value of 0ns if a conversion can not be made.
func Float32 ¶
Float32 will convert the given value to a float32, returns the default value of 0.0 if a conversion can not be made.
func Float64 ¶
Float64 will convert the given value to a float64, returns the default value of 0.0 if a conversion can not be made.
func Infer ¶
func Infer(into, from interface{}) error
Infer will perform conversion by inferring the conversion operation from the base type of a pointer to a supported T.
Example:
var into int64 err := conv.Infer(&into, `12`) // into -> 12
See examples for more usages.
func Int ¶
Int will convert the given value to a int, returns the default value of 0 if a conversion can not be made.
func Int16 ¶
Int16 will convert the given value to a int16, returns the default value of 0 if a conversion can not be made.
func Int32 ¶
Int32 will convert the given value to a int32, returns the default value of 0 if a conversion can not be made.
func Int64 ¶
Int64 will convert the given value to a int64, returns the default value of 0 if a conversion can not be made.
func Int8 ¶
Int8 will convert the given value to a int8, returns the default value of 0 if a conversion can not be made.
func String ¶
String will convert the given value to a string, returns the default value of "" if a conversion can not be made.
func Time ¶
Time will convert the given value to a time.Time, returns the empty struct time.Time{} if a conversion can not be made.
func Uint ¶
Uint will convert the given value to a uint, returns the default value of 0 if a conversion can not be made.
func Uint16 ¶
Uint16 will convert the given value to a uint16, returns the default value of 0 if a conversion can not be made.
func Uint32 ¶
Uint32 will convert the given value to a uint32, returns the default value of 0 if a conversion can not be made.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
convert
Package convert contains common conversion interfaces.
|
Package convert contains common conversion interfaces. |
refconv
Package refconv implements the Converter interface by using the standard libraries reflection package.
|
Package refconv implements the Converter interface by using the standard libraries reflection package. |