forked from SoftwareDefinedBuildings/XBOS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.go
50 lines (47 loc) · 804 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
package driver
type Type uint
const (
UNKNOWN = iota
BOOLEAN
FLOAT64
INT64
UINT64
STRING
TRIPLE
ARRAY_BOOLEAN
ARRAY_FLOAT64
ARRAY_INT64
ARRAY_UINT64
ARRAY_STRING
ARRAY_TRIPLE
)
func TypeFromString(s string) Type {
switch s {
case "bool", "boolean":
return BOOLEAN
case "float64", "float", "double":
return FLOAT64
case "int64", "int":
return INT64
case "uint64", "uint":
return UINT64
case "string":
return STRING
case "triple":
return TRIPLE
case "[]bool", "[]boolean":
return ARRAY_BOOLEAN
case "[]float64", "[]float", "[]double":
return ARRAY_FLOAT64
case "[]int64", "[]int":
return ARRAY_INT64
case "[]uint64", "[]uint":
return ARRAY_UINT64
case "[]string":
return ARRAY_STRING
case "[]triple":
return ARRAY_TRIPLE
default:
return UNKNOWN
}
}