vm

package
v0.0.0-...-c9c7940 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValueNull     = luluo.ValueNull
	ValueBool     = luluo.ValueBool
	ValueString   = luluo.ValueString
	ValueInt64    = luluo.ValueInt64
	ValueUint64   = luluo.ValueUint64
	ValueFloat64  = luluo.ValueFloat64
	ValueDatetime = luluo.ValueDatetime
	ValueInterval = luluo.ValueInterval
	ValueAny      = luluo.ValueAny
)

Variables

View Source
var AggFuncs = map[string]func() Aggregator{
	"count": func() Aggregator {
		return &countAgg{}
	},
	"sum": func() Aggregator {
		return &sumAgg{
			sum: IntToValue(0),
		}
	},
	"avg": func() Aggregator {
		return &avgAgg{
			sum: IntToValue(0),
		}
	},
}
View Source
var ErrNotFound = errors.ErrNotFound
View Source
var ErrUnknownValueType = luluo.ErrUnknownValueType
View Source
var Funcs = map[string]func(ctx Context, values []Value) (Value, error){
	"round": Round,
}

Functions

func And

func And(left, right func(Context) (bool, error)) func(Context) (bool, error)

func Between

func Between(left, from, to func(Context) (Value, error)) func(Context) (bool, error)

func CallFunc

func CallFunc(call func(Context, []Value) (Value, error), readValues func(Context) ([]Value, error)) func(ctx Context) (Value, error)

func ConvertToBool

func ConvertToBool(readValue func(Context) (Value, error)) func(Context) (Value, error)

func ConvertToDatetime

func ConvertToDatetime(readValue func(Context) (Value, error)) func(Context) (Value, error)

func ConvertToInt

func ConvertToInt(readValue func(Context) (Value, error)) func(Context) (Value, error)

func ConvertToUint

func ConvertToUint(readValue func(Context) (Value, error)) func(Context) (Value, error)

func DatetimeToInt

func DatetimeToInt(t time.Time) int64

func DivFunc

func DivFunc(left, right func(Context) (Value, error)) func(Context) (Value, error)

func DurationToInt

func DurationToInt(t time.Duration) int64

func Equal

func Equal(left, right func(Context) (Value, error)) func(Context) (bool, error)

func GreaterEqual

func GreaterEqual(left, right func(Context) (Value, error)) func(Context) (bool, error)

func GreaterThan

func GreaterThan(left, right func(Context) (Value, error)) func(Context) (bool, error)

func In

func In(left func(Context) (Value, error), right func(Context) ([]Value, error)) func(Context) (bool, error)

func IntDivFunc

func IntDivFunc(left, right func(Context) (Value, error)) func(Context) (Value, error)

func IntToDatetime

func IntToDatetime(t int64) time.Time

func IntToDuration

func IntToDuration(t int64) time.Duration

func IntToInterval

func IntToInterval(t int64) time.Duration

func IntervalToInt

func IntervalToInt(t time.Duration) int64

func IsFalse

func IsFalse(value func(Context) (Value, error)) func(Context) (bool, error)

func IsNotFalse

func IsNotFalse(value func(Context) (Value, error)) func(Context) (bool, error)

func IsNotNull

func IsNotNull(value func(Context) (Value, error)) func(Context) (bool, error)

func IsNotTrue

func IsNotTrue(value func(Context) (Value, error)) func(Context) (bool, error)

func IsNull

func IsNull(value func(Context) (Value, error)) func(Context) (bool, error)

func IsTrue

func IsTrue(value func(Context) (Value, error)) func(Context) (bool, error)

func LessEqual

func LessEqual(left, right func(Context) (Value, error)) func(Context) (bool, error)

func LessThan

func LessThan(left, right func(Context) (Value, error)) func(Context) (bool, error)

func Like

func Like(left, right func(Context) (Value, error)) func(Context) (bool, error)

func MinusFunc

func MinusFunc(left, right func(Context) (Value, error)) func(Context) (Value, error)

func ModFunc

func ModFunc(left, right func(Context) (Value, error)) func(Context) (Value, error)

func MultFunc

func MultFunc(left, right func(Context) (Value, error)) func(Context) (Value, error)

func NewArithmeticError

func NewArithmeticError(op, left, right string) error

func NewTypeError

func NewTypeError(r interface{}, actual, expected string) error

func NewTypeMismatch

func NewTypeMismatch(actual, expected string) error

func Not

func Not(f func(Context) (bool, error)) func(Context) (bool, error)

func NotBetween

func NotBetween(left, from, to func(Context) (Value, error)) func(Context) (bool, error)

func NotEqual

func NotEqual(left, right func(Context) (Value, error)) func(Context) (bool, error)

func NotIn

func NotIn(left func(Context) (Value, error), right func(Context) ([]Value, error)) func(Context) (bool, error)

func NotLike

func NotLike(left, right func(Context) (Value, error)) func(Context) (bool, error)

func NotRegexp

func NotRegexp(left, right func(Context) (Value, error)) func(Context) (bool, error)

func Or

func Or(left, right func(Context) (bool, error)) func(Context) (bool, error)

func PlusFunc

func PlusFunc(left, right func(Context) (Value, error)) func(Context) (Value, error)

func Regexp

func Regexp(left, right func(Context) (Value, error)) func(Context) (bool, error)

func ToDatetime

func ToDatetime(s string) (time.Time, error)

func ToSwitch

func ToSwitch(condList []func(Context) (bool, error),
	valueList []func(Context) (Value, error),
	elseValue func(Context) (Value, error)) func(Context) (Value, error)

func ToSwitchWithValue

func ToSwitchWithValue(readValue func(Context) (Value, error),
	condList []func(Context) (Value, error),
	valueList []func(Context) (Value, error),
	elseValue func(Context) (Value, error)) func(Context) (Value, error)

func UminusFunc

func UminusFunc(read func(Context) (Value, error)) func(Context) (Value, error)

Types

type Aggregator

type Aggregator interface {
	Agg(Value) error

	Result() (Value, error)
}

type CompareOption

type CompareOption = luluo.CompareOption

func EmptyCompareOption

func EmptyCompareOption() CompareOption

type Context

type Context = GetValuer

type GetValueFunc

type GetValueFunc func(tableName, name string) (Value, error)

func (GetValueFunc) GetValue

func (f GetValueFunc) GetValue(tableName, name string) (Value, error)

type GetValuer

type GetValuer interface {
	GetValue(tableName, name string) (Value, error)
}

type TypeError

type TypeError = luluo.TypeError

type Value

type Value = luluo.Value

func AnyToValue

func AnyToValue(value interface{}) Value

func BoolToValue

func BoolToValue(value bool) Value

func DatetimeToValue

func DatetimeToValue(value time.Time) Value

func Div

func Div(leftValue, rightValue Value) (Value, error)

func DivInt

func DivInt(leftValue Value, rightValue int64) (Value, error)

func DivUint

func DivUint(leftValue Value, rightValue uint64) (Value, error)

func DurationToValue

func DurationToValue(value time.Duration) Value

func FloatToValue

func FloatToValue(value float64) Value

func IntDiv

func IntDiv(leftValue, rightValue Value) (Value, error)

func IntToValue

func IntToValue(value int64) Value

func IntervalToValue

func IntervalToValue(value time.Duration) Value

func Minus

func Minus(leftValue, rightValue Value) (Value, error)

func Mod

func Mod(leftValue, rightValue Value) (Value, error)

func Mult

func Mult(leftValue, rightValue Value) (Value, error)

func MustToValue

func MustToValue(value interface{}) Value

func Null

func Null() Value

func Plus

func Plus(leftValue, rightValue Value) (Value, error)

func ReadValueFromString

func ReadValueFromString(s string) Value

func Round

func Round(ctx Context, values []Value) (Value, error)

func StringAsNumber

func StringAsNumber(s string) (Value, error)

func StringToValue

func StringToValue(value string) Value

func ToDatetimeValue

func ToDatetimeValue(s string) (Value, error)

func ToValue

func ToValue(value interface{}) (Value, error)

func UintToValue

func UintToValue(value uint64) Value

func Uminus

func Uminus(value Value) (Value, error)

type ValueType

type ValueType = luluo.ValueType

Jump to

Keyboard shortcuts

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