Documentation
¶
Overview ¶
Package to help convert safely interface{} values into specific types
Index ¶
- Constants
- Variables
- func AsBool(v interface{}) (bool, error)
- func AsBoolSlice(v interface{}) ([]bool, error)
- func AsInt(v interface{}) (int, error)
- func AsInt8(v interface{}) (int8, error)
- func AsInt8Slice(v interface{}) ([]int8, error)
- func AsInt16(v interface{}) (int16, error)
- func AsInt16Slice(v interface{}) ([]int16, error)
- func AsInt32(v interface{}) (int32, error)
- func AsInt32Slice(v interface{}) ([]int32, error)
- func AsInt64(v interface{}) (int64, error)
- func AsInt64Slice(v interface{}) ([]int64, error)
- func AsIntN(v interface{}, bitsize int) (int64, error)
- func AsIntSlice(v interface{}) ([]int, error)
- func AsSlice(v interface{}) ([]interface{}, error)
- func AsString(v interface{}) (string, error)
- func AsStringSlice(v interface{}) ([]string, error)
- func AsUint(v interface{}) (uint, error)
- func AsUint8(v interface{}) (uint8, error)
- func AsUint8Slice(v interface{}) ([]uint8, error)
- func AsUint16(v interface{}) (uint16, error)
- func AsUint16Slice(v interface{}) ([]uint16, error)
- func AsUint32(v interface{}) (uint32, error)
- func AsUint32Slice(v interface{}) ([]uint32, error)
- func AsUint64(v interface{}) (uint64, error)
- func AsUint64Slice(v interface{}) ([]uint64, error)
- func AsUintN(v interface{}, bitsize int) (uint64, error)
- func AsUintSlice(v interface{}) ([]uint, error)
- func InvalidTypeError(v interface{}) error
Constants ¶
const IntSize = 32 << (^uint(0) >> 32 & 1) // 32 or 64
Variables ¶
var (
ErrOutOfRange = errors.New("Value out of range")
)
Functions ¶
func AsBoolSlice ¶ added in v0.13.0
AsBoolSlice tries to convert data into a slice of bool
func AsInt8Slice ¶
AsInt8Slice tries to convert data into a slice of int8
func AsInt16Slice ¶
AsInt16Slice tries to convert data into a slice of int16
func AsInt32Slice ¶
AsInt32Slice tries to convert data into a slice of int32
func AsInt64Slice ¶
AsInt64Slice tries to convert data into a slice of int64
func AsIntSlice ¶
AsIntSlice tries to convert data into a slice of int
func AsSlice ¶
func AsSlice(v interface{}) ([]interface{}, error)
AsInt tries to convert data into a slice of something
func AsStringSlice ¶
AsStringSlice tries to convert data into a slice of string
func AsUint8Slice ¶
AsUint8Slice tries to convert data into a slice of uint8
func AsUint16Slice ¶
AsUint16Slice tries to convert data into a slice of uint16
func AsUint32Slice ¶
AsUint32Slice tries to convert data into a slice of uint32
func AsUint64Slice ¶
AsUint64Slice tries to convert data into a slice of uint64
func AsUintSlice ¶
AsUintSlice tries to convert data into a slice of uint
func InvalidTypeError ¶
func InvalidTypeError(v interface{}) error
Types ¶
This section is empty.