-
Notifications
You must be signed in to change notification settings - Fork 1
/
type.go
94 lines (81 loc) · 1.28 KB
/
type.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright 2014 Jonas mg
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package datautil implements a subset of Go types for the data management.
package datautil
// A Type represents a Go type.
type Type int
const (
Custom Type = -1
_ = iota
Bool
// Integers
Int
Int8
Int16
Int32
Int64
// Unsigned integers
Uint
Uint8
Uint16
Uint32
Uint64
// Float-point numbers
Float32
Float64
String
RawBytes
Slice
//Map
//Struct
Time
//Nil
)
func (k Type) String() string {
switch k {
case Bool:
return "bool"
case Int:
return "int"
case Int8:
return "int8"
case Int16:
return "int16"
case Int32:
return "int32"
case Int64:
return "int64"
case Uint:
return "uint"
case Uint8:
return "uint8"
case Uint16:
return "uint16"
case Uint32:
return "uint32"
case Uint64:
return "uint64"
case Float32:
return "float32"
case Float64:
return "float64"
case String:
return "string"
case RawBytes:
return "[]byte"
case Slice:
return "[]"
//case Map:
//return "map"
//case Struct:
//return "struct"
case Time:
return "time"
//case Nil:
//return "NULL"
}
panic("unimplemented")
}