coerce

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: BSD-3-Clause Imports: 9 Imported by: 11

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 ToConnection

func ToConnection(val interface{}) (connection.Manager, error)

func ToDateTime

func ToDateTime(val interface{}) (time.Time, error)

func ToFloat32

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

ToFloat32 coerce a value to a double/float32

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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