cast

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnableToCast          = errors.New("unable to cast value")
	ErrUnableToCastToInt     = fmt.Errorf("%w to int", ErrUnableToCast)
	ErrUnableToCastToInt64   = fmt.Errorf("%w to int64", ErrUnableToCast)
	ErrUnableToCastToInt32   = fmt.Errorf("%w to int32", ErrUnableToCast)
	ErrUnableToCastToInt16   = fmt.Errorf("%w to int16", ErrUnableToCast)
	ErrUnableToCastToInt8    = fmt.Errorf("%w to int8", ErrUnableToCast)
	ErrUnableToCastToUint    = fmt.Errorf("%w to uint", ErrUnableToCast)
	ErrUnableToCastToUint64  = fmt.Errorf("%w to uint64", ErrUnableToCast)
	ErrUnableToCastToUint32  = fmt.Errorf("%w to uint32", ErrUnableToCast)
	ErrUnableToCastToUint16  = fmt.Errorf("%w to uint16", ErrUnableToCast)
	ErrUnableToCastToUint8   = fmt.Errorf("%w to uint8", ErrUnableToCast)
	ErrUnableToCastToFloat64 = fmt.Errorf("%w to float64", ErrUnableToCast)
	ErrUnableToCastToFloat32 = fmt.Errorf("%w to float32", ErrUnableToCast)
	ErrUnableToCastToBool    = fmt.Errorf("%w to bool", ErrUnableToCast)
	ErrUnableToCastToNumber  = fmt.Errorf("%w to number", ErrUnableToCast)
	ErrUnableToCastToString  = fmt.Errorf("%w to string", ErrUnableToCast)
	ErrUnableToCastToBinary  = fmt.Errorf("%w to binary", ErrUnableToCast)
	ErrUnableToCastToTime    = fmt.Errorf("%w to time", ErrUnableToCast)
)
View Source
var TimeStringFormat = time.RFC3339

Functions

func To

func To(targetType interface{}, val interface{}) (interface{}, error)

func ToBinary

func ToBinary(i interface{}) (interface{}, error)

func ToBool

func ToBool(i interface{}) (interface{}, error)

func ToFloat32

func ToFloat32(i interface{}) (interface{}, error)

func ToFloat64

func ToFloat64(i interface{}) (interface{}, error)

func ToInt

func ToInt(i interface{}) (interface{}, error)

func ToInt16

func ToInt16(i interface{}) (interface{}, error)

func ToInt32

func ToInt32(i interface{}) (interface{}, error)

func ToInt64

func ToInt64(i interface{}) (interface{}, error)

func ToInt8

func ToInt8(i interface{}) (interface{}, error)

func ToNumber

func ToNumber(i interface{}) (interface{}, error)

func ToString

func ToString(i interface{}) (interface{}, error)

func ToTime

func ToTime(i interface{}) (interface{}, error)

func ToTimestamp

func ToTimestamp(i interface{}) (interface{}, error)

func ToUint

func ToUint(i interface{}) (interface{}, error)

func ToUint16

func ToUint16(i interface{}) (interface{}, error)

func ToUint32

func ToUint32(i interface{}) (interface{}, error)

func ToUint64

func ToUint64(i interface{}) (interface{}, error)

func ToUint8

func ToUint8(i interface{}) (interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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