coerce

package
v1.6.25 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: BSD-3-Clause Imports: 9 Imported by: 651 modules, 930 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func ToDateTime added in v1.0.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