diff pkg/controllers/surveys.go @ 4242:1458c9b0fdaa json-handler-middleware

Made the sql.Conn in function accessible via the context of the request.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 22 Aug 2019 10:18:13 +0200
parents 80e9cfb2be98
children d776110b4db0
line wrap: on
line diff
--- a/pkg/controllers/surveys.go	Thu Aug 22 09:20:38 2019 +0200
+++ b/pkg/controllers/surveys.go	Thu Aug 22 10:18:13 2019 +0200
@@ -44,14 +44,13 @@
 func listSurveys(
 	_ interface{},
 	req *http.Request,
-	db *sql.Conn,
 ) (jr JSONResult, err error) {
 
 	bottleneckName := mux.Vars(req)["bottleneck"]
 
 	var rows *sql.Rows
 
-	rows, err = db.QueryContext(req.Context(), listSurveysSQL, bottleneckName)
+	rows, err = JSONConn(req).QueryContext(req.Context(), listSurveysSQL, bottleneckName)
 	if err != nil {
 		return
 	}