diff pkg/controllers/gauges.go @ 3190:54a3e40cfbed

controllers: moved filter builder to a separate file.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 08 May 2019 10:50:14 +0200
parents 41ed69dbf9bb
children eeff2cc4ff9d
line wrap: on
line diff
--- a/pkg/controllers/gauges.go	Wed May 08 10:37:47 2019 +0200
+++ b/pkg/controllers/gauges.go	Wed May 08 10:50:14 2019 +0200
@@ -631,7 +631,7 @@
 	var fb filterBuilder
 	fb.stmt.WriteString(selectWaterlevelsSQL)
 
-	fb.cond(
+	fb.and(
 		" fk_gauge_id = ($%d::char(2), $%d::char(3), $%d::char(5), $%d::char(5), $%d::int) ",
 		isrs.CountryCode,
 		isrs.LoCode,
@@ -640,7 +640,7 @@
 		isrs.Hectometre,
 	)
 
-	fb.cond(
+	fb.and(
 		`(NOT predicted
          OR (
            date_issue = (
@@ -663,7 +663,7 @@
 				http.StatusBadRequest)
 			return
 		}
-		fb.cond("measure_date >= $%d", fromTime)
+		fb.and("measure_date >= $%d", fromTime)
 	}
 
 	if to := req.FormValue("to"); to != "" {
@@ -674,7 +674,7 @@
 				http.StatusBadRequest)
 			return
 		}
-		fb.cond("measure_date <= $%d", toTime)
+		fb.and("measure_date <= $%d", toTime)
 	}
 
 	conn := middleware.GetDBConn(req)