dal/pkg/utils/sql_format.go
Anton Nesterov fde44ce343
[wip] convert insert
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-09 16:14:42 +02:00

29 lines
453 B
Go

package utils
import (
"slices"
"strings"
"unicode"
)
func IsSQLFunction(str string) bool {
stopChars := []string{" ", "_", "-", ".", "("}
isUpper := false
for _, char := range str {
if slices.Contains(stopChars, string(char)) {
break
}
if unicode.IsUpper(char) {
isUpper = true
} else {
isUpper = false
break
}
}
return isUpper
}
func EscapeSingleQuote(str string) string {
return strings.ReplaceAll(str, "'", "''")
}