forked from sqls-server/sqls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dialect.go
34 lines (26 loc) · 910 Bytes
/
dialect.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
package dialect
type Dialect interface {
IsIdentifierStart(r rune) bool
IsIdentifierPart(r rune) bool
IsDelimitedIdentifierStart(r rune) bool
IsPlaceHolderStart(r rune) bool
IsPlaceHolderPart(r rune) bool
}
type GenericSQLDialect struct {
}
func (*GenericSQLDialect) IsIdentifierStart(r rune) bool {
return (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || r == '@'
}
func (*GenericSQLDialect) IsIdentifierPart(r rune) bool {
return (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '@' || r == '_'
}
func (*GenericSQLDialect) IsDelimitedIdentifierStart(r rune) bool {
return r == '"' || r == '`'
}
func (*GenericSQLDialect) IsPlaceHolderStart(r rune) bool {
return r == '$'
}
func (*GenericSQLDialect) IsPlaceHolderPart(r rune) bool {
return (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9')
}
var _ Dialect = &GenericSQLDialect{}