conv

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TYPE_STRING  = reflect.TypeOf("")
	TYPE_BOOL    = reflect.TypeOf(true)
	TYPE_INT     = reflect.TypeOf(int(0))
	TYPE_INT8    = reflect.TypeOf(int8(0))
	TYPE_INT16   = reflect.TypeOf(int16(0))
	TYPE_INT32   = reflect.TypeOf(int32(0))
	TYPE_INT64   = reflect.TypeOf(int64(0))
	TYPE_UINT    = reflect.TypeOf(uint(0))
	TYPE_UINT8   = reflect.TypeOf(uint8(0))
	TYPE_UINT16  = reflect.TypeOf(uint16(0))
	TYPE_UINT32  = reflect.TypeOf(uint32(0))
	TYPE_UINT64  = reflect.TypeOf(uint64(0))
	TYPE_FLOAT32 = reflect.TypeOf(float32(0))
	TYPE_FLOAT64 = reflect.TypeOf(float64(0))

	TYPE_STRING_SLICE    = reflect.TypeOf([]string(nil))
	TYPE_INTERFACE_SLICE = reflect.TypeOf([]interface{}(nil))

	TYPE_STRING_STRING_MAP       = reflect.TypeOf(map[string]string(nil))
	TYPE_STRING_INTERFACE_MAP    = reflect.TypeOf(map[string]interface{}(nil))
	TYPE_INTERFACE_INTERFACE_MAP = reflect.TypeOf(map[interface{}]interface{}(nil))
)

Functions

func AsBool

func AsBool(value interface{}) bool

func AsBoolSlice

func AsBoolSlice(values interface{}) []bool

func AsDuration

func AsDuration(value interface{}) time.Duration

func AsFloat32

func AsFloat32(value interface{}) float32

func AsFloat32Slice

func AsFloat32Slice(values interface{}) []float32

func AsFloat64

func AsFloat64(value interface{}) float64

func AsFloat64Slice

func AsFloat64Slice(values interface{}) []float64

func AsIP

func AsIP(value interface{}) net.IP

func AsInt

func AsInt(value interface{}) int

func AsInt16

func AsInt16(value interface{}) int16

func AsInt16Slice

func AsInt16Slice(values interface{}) []int16

func AsInt32

func AsInt32(value interface{}) int32

func AsInt32Slice

func AsInt32Slice(values interface{}) []int32

func AsInt64

func AsInt64(value interface{}) int64

func AsInt64Slice

func AsInt64Slice(values interface{}) []int64

func AsInt8

func AsInt8(value interface{}) int8

func AsInt8Slice

func AsInt8Slice(values interface{}) []int8

func AsIntSlice

func AsIntSlice(values interface{}) []int

func AsInterfaceInterfaceMap

func AsInterfaceInterfaceMap(value interface{}) map[interface{}]interface{}

func AsLocation

func AsLocation(value interface{}) *time.Location

func AsString

func AsString(value interface{}) string

func AsStringInterfaceMap

func AsStringInterfaceMap(value interface{}) map[string]interface{}

func AsStringSlice

func AsStringSlice(values interface{}) []string

func AsStringStringMap

func AsStringStringMap(value interface{}) map[string]string

func AsTime

func AsTime(value interface{}) time.Time

func AsURL

func AsURL(value interface{}) *url.URL

func AsUint

func AsUint(value interface{}) uint

func AsUint16

func AsUint16(value interface{}) uint16

func AsUint16Slice

func AsUint16Slice(values interface{}) []uint16

func AsUint32

func AsUint32(value interface{}) uint32

func AsUint32Slice

func AsUint32Slice(values interface{}) []uint32

func AsUint64

func AsUint64(value interface{}) uint64

func AsUint64Slice

func AsUint64Slice(values interface{}) []uint64

func AsUint8

func AsUint8(value interface{}) uint8

func AsUint8Slice

func AsUint8Slice(values interface{}) []uint8

func AsUintSlice

func AsUintSlice(values interface{}) []uint

func ConvertAs

func ConvertAs(value interface{}, rtype reflect.Type) interface{}

func ConvertTo

func ConvertTo(value interface{}, rtype reflect.Type) (interface{}, error)

func Indirect

func Indirect(a interface{}) interface{}

Indirect returns the value, after dereferencing as many times as necessary to reach the base type (or nil).

func ToBool

func ToBool(value interface{}) (bool, error)

func ToBoolSlice

func ToBoolSlice(values interface{}) ([]bool, error)

func ToDuration

func ToDuration(value interface{}) (time.Duration, error)

func ToFloat32

func ToFloat32(value interface{}) (float32, error)

func ToFloat32Slice

func ToFloat32Slice(values interface{}) ([]float32, error)

func ToFloat64

func ToFloat64(value interface{}) (float64, error)

func ToFloat64Slice

func ToFloat64Slice(values interface{}) ([]float64, error)

func ToIP

func ToIP(value interface{}) (net.IP, error)

func ToInt

func ToInt(value interface{}) (int, error)

func ToInt16

func ToInt16(value interface{}) (int16, error)

func ToInt16Slice

func ToInt16Slice(values interface{}) ([]int16, error)

func ToInt32

func ToInt32(value interface{}) (int32, error)

func ToInt32Slice

func ToInt32Slice(values interface{}) ([]int32, error)

func ToInt64

func ToInt64(value interface{}) (int64, error)

func ToInt64Slice

func ToInt64Slice(values interface{}) ([]int64, error)

func ToInt8

func ToInt8(value interface{}) (int8, error)

func ToInt8Slice

func ToInt8Slice(values interface{}) ([]int8, error)

func ToIntSlice

func ToIntSlice(values interface{}) ([]int, error)

func ToInterfaceInterfaceMap

func ToInterfaceInterfaceMap(value interface{}) (map[interface{}]interface{}, error)

func ToLocation

func ToLocation(value interface{}) (*time.Location, error)

func ToString

func ToString(value interface{}) (string, error)

func ToStringInterfaceMap

func ToStringInterfaceMap(value interface{}) (map[string]interface{}, error)

func ToStringSlice

func ToStringSlice(values interface{}) ([]string, error)

func ToStringStringMap

func ToStringStringMap(value interface{}) (map[string]string, error)

func ToTime

func ToTime(value interface{}) (time.Time, error)

func ToURL

func ToURL(value interface{}) (*url.URL, error)

func ToUint

func ToUint(value interface{}) (uint, error)

func ToUint16

func ToUint16(value interface{}) (uint16, error)

func ToUint16Slice

func ToUint16Slice(values interface{}) ([]uint16, error)

func ToUint32

func ToUint32(value interface{}) (uint32, error)

func ToUint32Slice

func ToUint32Slice(values interface{}) ([]uint32, error)

func ToUint64

func ToUint64(value interface{}) (uint64, error)

func ToUint64Slice

func ToUint64Slice(values interface{}) ([]uint64, error)

func ToUint8

func ToUint8(value interface{}) (uint8, error)

func ToUint8Slice

func ToUint8Slice(values interface{}) ([]uint8, error)

func ToUintSlice

func ToUintSlice(values interface{}) ([]uint, error)

Types

type Value

type Value struct {
	Data interface{}
}

func NewValue

func NewValue(v interface{}) *Value

func (*Value) AsBool

func (v *Value) AsBool() bool

func (*Value) AsBoolSlice

func (v *Value) AsBoolSlice() []bool

func (*Value) AsFloat32

func (v *Value) AsFloat32() float32

func (*Value) AsFloat32Slice

func (v *Value) AsFloat32Slice() []float32

func (*Value) AsFloat64

func (v *Value) AsFloat64() float64

func (*Value) AsFloat64Slice

func (v *Value) AsFloat64Slice() []float64

func (*Value) AsInt

func (v *Value) AsInt() int

func (*Value) AsInt16

func (v *Value) AsInt16() int16

func (*Value) AsInt16Slice

func (v *Value) AsInt16Slice() []int16

func (*Value) AsInt32

func (v *Value) AsInt32() int32

func (*Value) AsInt32Slice

func (v *Value) AsInt32Slice() []int32

func (*Value) AsInt64

func (v *Value) AsInt64() int64

func (*Value) AsInt64Slice

func (v *Value) AsInt64Slice() []int64

func (*Value) AsInt8

func (v *Value) AsInt8() int8

func (*Value) AsInt8Slice

func (v *Value) AsInt8Slice() []int8

func (*Value) AsIntSlice

func (v *Value) AsIntSlice() []int

func (*Value) AsInterfaceInterfaceMap

func (v *Value) AsInterfaceInterfaceMap() map[interface{}]interface{}

func (*Value) AsString

func (v *Value) AsString() string

func (*Value) AsStringInterfaceMap

func (v *Value) AsStringInterfaceMap() map[string]interface{}

func (*Value) AsStringSlice

func (v *Value) AsStringSlice() []string

func (*Value) AsStringStringMap

func (v *Value) AsStringStringMap() map[string]string

func (*Value) AsUint

func (v *Value) AsUint() uint

func (*Value) AsUint16

func (v *Value) AsUint16() uint16

func (*Value) AsUint16Slice

func (v *Value) AsUint16Slice() []uint16

func (*Value) AsUint32

func (v *Value) AsUint32() uint32

func (*Value) AsUint32Slice

func (v *Value) AsUint32Slice() []uint32

func (*Value) AsUint64

func (v *Value) AsUint64() uint64

func (*Value) AsUint64Slice

func (v *Value) AsUint64Slice() []uint64

func (*Value) AsUint8

func (v *Value) AsUint8() uint8

func (*Value) AsUint8Slice

func (v *Value) AsUint8Slice() []uint8

func (*Value) AsUintSlice

func (v *Value) AsUintSlice() []uint

func (*Value) IsNil

func (v *Value) IsNil() bool

func (*Value) ToBool

func (v *Value) ToBool() (bool, error)

func (*Value) ToBoolSlice

func (v *Value) ToBoolSlice() ([]bool, error)

func (*Value) ToFloat32

func (v *Value) ToFloat32() (float32, error)

func (*Value) ToFloat32Slice

func (v *Value) ToFloat32Slice() ([]float32, error)

func (*Value) ToFloat64

func (v *Value) ToFloat64() (float64, error)

func (*Value) ToFloat64Slice

func (v *Value) ToFloat64Slice() ([]float64, error)

func (*Value) ToInt

func (v *Value) ToInt() (int, error)

func (*Value) ToInt16

func (v *Value) ToInt16() (int16, error)

func (*Value) ToInt16Slice

func (v *Value) ToInt16Slice() ([]int16, error)

func (*Value) ToInt32

func (v *Value) ToInt32() (int32, error)

func (*Value) ToInt32Slice

func (v *Value) ToInt32Slice() ([]int32, error)

func (*Value) ToInt64

func (v *Value) ToInt64() (int64, error)

func (*Value) ToInt64Slice

func (v *Value) ToInt64Slice() ([]int64, error)

func (*Value) ToInt8

func (v *Value) ToInt8() (int8, error)

func (*Value) ToInt8Slice

func (v *Value) ToInt8Slice() ([]int8, error)

func (*Value) ToIntSlice

func (v *Value) ToIntSlice() ([]int, error)

func (*Value) ToInterfaceInterfaceMap

func (v *Value) ToInterfaceInterfaceMap() (map[interface{}]interface{}, error)

func (*Value) ToString

func (v *Value) ToString() (string, error)

func (*Value) ToStringInterfaceMap

func (v *Value) ToStringInterfaceMap() (map[string]interface{}, error)

func (*Value) ToStringSlice

func (v *Value) ToStringSlice() ([]string, error)

func (*Value) ToStringStringMap

func (v *Value) ToStringStringMap() (map[string]string, error)

func (*Value) ToUint

func (v *Value) ToUint() (uint, error)

func (*Value) ToUint16

func (v *Value) ToUint16() (uint16, error)

func (*Value) ToUint16Slice

func (v *Value) ToUint16Slice() ([]uint16, error)

func (*Value) ToUint32

func (v *Value) ToUint32() (uint32, error)

func (*Value) ToUint32Slice

func (v *Value) ToUint32Slice() ([]uint32, error)

func (*Value) ToUint64

func (v *Value) ToUint64() (uint64, error)

func (*Value) ToUint64Slice

func (v *Value) ToUint64Slice() ([]uint64, error)

func (*Value) ToUint8

func (v *Value) ToUint8() (uint8, error)

func (*Value) ToUint8Slice

func (v *Value) ToUint8Slice() ([]uint8, error)

func (*Value) ToUintSlice

func (v *Value) ToUintSlice() ([]uint, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL