Skip to content

Commit fae9a08

Browse files
author
Hein
committed
refactor: 🚨 linting issues
1 parent 191822b commit fae9a08

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pkg/funcspec/function_api.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,12 @@ func (h *Handler) SqlQuery(sqlquery string, options SqlQueryOptions) HTTPFuncTyp
522522
if strings.HasPrefix(kLower, "x-fieldfilter-") {
523523
colname := strings.ReplaceAll(kLower, "x-fieldfilter-", "")
524524
if strings.Contains(strings.ToLower(sqlquery), colname) {
525-
if val == "0" {
525+
switch val {
526+
case "0":
526527
sqlquery = sqlQryWhere(sqlquery, fmt.Sprintf("COALESCE(%s, 0) = 0", ValidSQL(colname, "colname")))
527-
} else if val == "" {
528+
case "":
528529
sqlquery = sqlQryWhere(sqlquery, fmt.Sprintf("(%[1]s = '' OR %[1]s IS NULL)", ValidSQL(colname, "colname")))
529-
} else {
530+
default:
530531
if IsNumeric(val) {
531532
sqlquery = sqlQryWhere(sqlquery, fmt.Sprintf("%s = %s", ValidSQL(colname, "colname"), ValidSQL(val, "colvalue")))
532533
} else {
@@ -783,11 +784,12 @@ func (h *Handler) mergeHeaderParams(r *http.Request, sqlquery string, variables
783784
// Handle special headers
784785
if strings.Contains(k, "x-fieldfilter-") {
785786
colname := strings.ReplaceAll(k, "x-fieldfilter-", "")
786-
if val == "0" {
787+
switch val {
788+
case "0":
787789
sqlquery = sqlQryWhere(sqlquery, fmt.Sprintf("COALESCE(%s, 0) = 0", ValidSQL(colname, "colname")))
788-
} else if val == "" {
790+
case "":
789791
sqlquery = sqlQryWhere(sqlquery, fmt.Sprintf("(%[1]s = '' OR %[1]s IS NULL)", ValidSQL(colname, "colname")))
790-
} else {
792+
default:
791793
if IsNumeric(val) {
792794
sqlquery = sqlQryWhere(sqlquery, fmt.Sprintf("%s = %s", ValidSQL(colname, "colname"), ValidSQL(val, "colvalue")))
793795
} else {

0 commit comments

Comments
 (0)