-
Notifications
You must be signed in to change notification settings - Fork 0
/
const.go
32 lines (27 loc) · 1.19 KB
/
const.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package mathexp
import (
"errors"
"reflect"
)
var CondOps = map[string][]reflect.Type{
"and": {reflect.TypeOf(ConditionSpec{})},
"or": {reflect.TypeOf(ConditionSpec{})},
"eq": {reflect.TypeOf(reflect.String), reflect.TypeOf(reflect.Float64), reflect.TypeOf(reflect.Int64), reflect.TypeOf(reflect.Bool)},
"neq": {reflect.TypeOf(reflect.String), reflect.TypeOf(reflect.Float64), reflect.TypeOf(reflect.Int64), reflect.TypeOf(reflect.Bool)},
"lt": {reflect.TypeOf(reflect.String), reflect.TypeOf(reflect.Float64), reflect.TypeOf(reflect.Int64)},
"lte": {reflect.TypeOf(reflect.String), reflect.TypeOf(reflect.Float64), reflect.TypeOf(reflect.Int64)},
"gt": {reflect.TypeOf(reflect.String), reflect.TypeOf(reflect.Float64), reflect.TypeOf(reflect.Int64)},
"gte": {reflect.TypeOf(reflect.String), reflect.TypeOf(reflect.Float64), reflect.TypeOf(reflect.Int64)},
}
var MathOps = []string{"add", "sub", "mul", "div"}
const (
VarTypIn = "in"
VarTypOut = "out"
VarTypConst = "const"
VarTypExpOut = "expout"
)
var (
ErrExpNotValid = errors.New("Errors in the expression")
ErrArgsMismatch = errors.New("Provided args are not enough")
ErrUnexpectedType = errors.New("Unexpected type")
)