-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
52 lines (40 loc) · 865 Bytes
/
types.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package value
import (
"time"
"github.com/deepfabric/thinkbase/pkg/vm/types"
)
type Value interface {
Size() int
String() string
Compare(Value) int
ResolvedType() *types.T
IsLogical() bool
Attributes() []string
Eval(map[string]Value) (Value, error)
}
type Bool bool
type Int int64
type Float float64
type String string
type Null struct{}
type Array []Value
type Table struct {
Id string
}
type Time struct {
time.Time
}
var (
ConstTrue Bool = true
ConstFalse Bool = false
ConstNull Null = Null{}
ConstTable Table = Table{}
)
// time.Time formats.
const (
// TimeOutputFormat is used to output all time.
TimeOutputFormat = "2006-01-02 15:04:05"
)
func (a Array) Len() int { return len(a) }
func (a Array) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a Array) Less(i, j int) bool { return a[i].Compare(a[j]) < 0 }