just mov funcs to top of file
This commit is contained in:
parent
a3c6b8a90e
commit
d3ff7b40bb
@ -5,6 +5,23 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var setupReserved sync.Once
|
||||||
|
var reservedWords map[string]struct{}
|
||||||
|
|
||||||
|
func isReserved(w string) bool {
|
||||||
|
setupReserved.Do(
|
||||||
|
func() {
|
||||||
|
words := strings.Split(reserved, "\n")
|
||||||
|
reservedWords = make(map[string]struct{}, len(words))
|
||||||
|
for _, s := range words {
|
||||||
|
reservedWords[s] = struct{}{}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
_, ok := reservedWords[strings.ToUpper(w)]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
const reserved = `AGGREGATE
|
const reserved = `AGGREGATE
|
||||||
AGGREGATES
|
AGGREGATES
|
||||||
ALL
|
ALL
|
||||||
@ -147,20 +164,3 @@ WITH
|
|||||||
YEAR
|
YEAR
|
||||||
ZERO
|
ZERO
|
||||||
ZONE`
|
ZONE`
|
||||||
|
|
||||||
var setupReserved sync.Once
|
|
||||||
var reservedWords map[string]struct{}
|
|
||||||
|
|
||||||
func isReserved(w string) bool {
|
|
||||||
setupReserved.Do(
|
|
||||||
func() {
|
|
||||||
words := strings.Split(reserved, "\n")
|
|
||||||
reservedWords = make(map[string]struct{}, len(words))
|
|
||||||
for _, s := range words {
|
|
||||||
reservedWords[s] = struct{}{}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
_, ok := reservedWords[strings.ToUpper(w)]
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user