just mov funcs to top of file

This commit is contained in:
Jim Lambert 2020-02-13 21:44:40 -05:00
parent a3c6b8a90e
commit d3ff7b40bb

View File

@ -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
}