-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtoken.go
58 lines (46 loc) · 1.1 KB
/
token.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
package sqle
// TokenType represents the type of a token.
type TokenType uint
const (
TextToken TokenType = 0
InputToken TokenType = 1
ParamToken TokenType = 2
)
// Token is an interface that represents a SQL token.
type Token interface {
Type() TokenType
String() string
}
// Text represents a text token.
type Text string
// Type returns the type of the token.
// skipcq: RVV-B0013
func (t Text) Type() TokenType {
return TextToken
}
// String returns the string representation of the token.
func (t Text) String() string {
return string(t)
}
// Input represents an input token.
type Input string
// Type returns the type of the token.
// skipcq: RVV-B0013
func (t Input) Type() TokenType {
return InputToken
}
// String returns the string representation of the token.
func (t Input) String() string {
return string(t)
}
// Param represents a parameter token.
type Param string
// Type returns the type of the token.
// skipcq: RVV-B0013
func (t Param) Type() TokenType {
return ParamToken
}
// String returns the string representation of the token.
func (t Param) String() string {
return string(t)
}