coerce

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IncompatibleTypes = errors.New("incompatible types")
View Source
var Overflow = errors.New("integer overflow: uint64 value too large for int64")

Functions

func ToBool

func ToBool(val *zed.Value) (bool, bool)

func ToFloat

func ToFloat(val *zed.Value) (float64, bool)

func ToInt

func ToInt(val *zed.Value) (int64, bool)

func ToUint

func ToUint(val *zed.Value) (uint64, bool)

Types

type Pair

type Pair struct {
	// a and b point to inputs that can't change
	A zcode.Bytes
	B zcode.Bytes
	// Buffer is a scratch buffer that stays around between calls and is the
	// landing place for either the a or b value if one of them needs to
	// be coerced (you never need to coerce both).  Then we point a or b
	// at buf and let go of the other input pointer.
	result.Buffer
	// contains filtered or unexported fields
}

Pair provides a buffer to decode values into while doing comparisons so the same buffers can be reused on each call without zcode.Bytes buffers escaping to GC. This method uses the zed.AppendInt(), zed.AppendUint(), etc to encode zcode.Bytes as an in-place slice instead of allocating new slice buffers for every value created.

func (*Pair) Coerce

func (c *Pair) Coerce(a, b *zed.Value) (int, error)

func (*Pair) Equal

func (c *Pair) Equal() bool

Jump to

Keyboard shortcuts

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