constant

package
v0.0.0-...-13da7e0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDivideByZero = errors.New("divide by zero")

Functions

func AsBool

func AsBool(v Value) (bool, error)

func AsBytes

func AsBytes(v Value) ([]byte, error)

func AsFloat

func AsFloat(v Value) (float64, error)

func AsInt

func AsInt(v Value) (*big.Int, error)

func AsInt64

func AsInt64(v Value) (int64, error)

func AsInterval

func AsInterval(v Value) (time.Duration, error)

func AsTimestamp

func AsTimestamp(v Value) (time.Time, error)

func Cmp

func Cmp(a, b Value) (_ int, isNull bool, retErr error)

func IsInt64

func IsInt64(v Value) bool

IsInt64 reports whether v can be represented as an int64.

func MakeBinaryOpError

func MakeBinaryOpError(op string, left, right Value, cause error) error

func MakeUnaryOpError

func MakeUnaryOpError(op string, val Value, cause error) error

func Sign

func Sign(v Value) int

Types

type BinaryOpError

type BinaryOpError struct {
	Op    string
	Left  Value
	Right Value
	Cause error
}

func (*BinaryOpError) Error

func (e *BinaryOpError) Error() string

func (*BinaryOpError) Unwrap

func (e *BinaryOpError) Unwrap() error

type CompareError

type CompareError struct {
	Left, Right Value
}

func (*CompareError) Error

func (e *CompareError) Error() string

type ConvertError

type ConvertError struct {
	From Value
	To   string
}

func (*ConvertError) Error

func (e *ConvertError) Error() string

type Kind

type Kind int

Kind specifies the kind of value represented by a Value.

const (
	KindNull Kind = iota
	KindBool
	KindBytes
	KindInt
	KindFloat
	KindTimestamp
	KindInterval
	KindArray
)

func (Kind) String

func (i Kind) String() string

type UnaryOpError

type UnaryOpError struct {
	Op    string
	Value Value
	Cause error
}

func (*UnaryOpError) Error

func (e *UnaryOpError) Error() string

type Value

type Value interface {
	Kind() Kind
	String() string
}
var Null Value = nullVal{}

func Add

func Add(a, b Value) (_ Value, retErr error)

func AsArray

func AsArray(v Value) ([]Value, error)

func Div

func Div(a, b Value) (_ Value, retErr error)

func FloatDiv

func FloatDiv(a, b Value) (_ Value, retErr error)

func MakeArray

func MakeArray(a []Value) Value

func MakeBool

func MakeBool(b bool) Value

func MakeBytes

func MakeBytes(b []byte) Value

func MakeFloat

func MakeFloat(f float64) Value

func MakeInt

func MakeInt(i *big.Int) Value

func MakeInt64

func MakeInt64(i int64) Value

func MakeInterval

func MakeInterval(d time.Duration) Value

func MakeNumberFromLiteral

func MakeNumberFromLiteral(s string) (Value, error)

MakeNumberFromLiteral makes a numeric value from a string literal. The string literal may be a decimal integer, a hexadecimal integer, or a floating-point number.

func MakeTimestamp

func MakeTimestamp(t time.Time) Value

func Mod

func Mod(a, b Value) (_ Value, retErr error)

func Mul

func Mul(a, b Value) (_ Value, retErr error)

func Neg

func Neg(a Value) (_ Value, retErr error)

func Sub

func Sub(a, b Value) (_ Value, retErr error)

Jump to

Keyboard shortcuts

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