coerce

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2019 License: BSD-3-Clause Imports: 6 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTypedValue

func NewTypedValue(dataType data.Type, value interface{}) (data.TypedValue, error)

func ToAny

func ToAny(val interface{}) (interface{}, error)

ToAny coerce a value to generic value

func ToArray

func ToArray(val interface{}) ([]interface{}, error)

ToArray coerce a value to an array of empty interface values

func ToArrayIfNecessary

func ToArrayIfNecessary(val interface{}) (interface{}, error)

ToArrayIfNecessary coerce a value to an array if it isn't one already

func ToBool

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

ToBool coerce a value to a boolean

func ToBytes

func ToBytes(val interface{}) ([]byte, error)

ToBytes coerce a value to a byte array

func ToFloat32

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

ToFloat64 coerce a value to a double/float64

func ToFloat64

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

ToFloat64 coerce a value to a double/float64

func ToInt

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

ToInt coerce a value to an int

func ToInt32

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

ToInteger coerce a value to an integer

func ToInt64

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

ToInteger coerce a value to an integer

func ToObject

func ToObject(val interface{}) (map[string]interface{}, error)

ToObject coerce a value to an object

func ToParams

func ToParams(val interface{}) (map[string]string, error)

ToParams coerce a value to params

func ToString

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

ToString coerce a value to a string

func ToType

func ToType(value interface{}, dataType data.Type) (interface{}, error)

ToType coerce a value to the specified type

func ToUInt64 added in v1.0.5

func ToUInt64(val interface{}) (uint64, error)

ToInteger coerce a value to an integer

Types

This section is empty.

Jump to

Keyboard shortcuts

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