Help us shape the future of Go! Take the 2026 Go Developer Survey

coerce

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 9 Imported by: 98

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 added in v0.1.0

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