diff pkg/controllers/srimports.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 34623265eac1
children d776110b4db0
line wrap: on
line diff
--- a/pkg/controllers/srimports.go	Thu Aug 22 09:20:38 2019 +0200
+++ b/pkg/controllers/srimports.go	Thu Aug 22 10:18:13 2019 +0200
@@ -15,7 +15,6 @@
 
 import (
 	"archive/zip"
-	"database/sql"
 	"encoding/hex"
 	"fmt"
 	"log"
@@ -193,7 +192,6 @@
 func uploadSoundingResult(
 	_ interface{},
 	req *http.Request,
-	conn *sql.Conn,
 ) (jr JSONResult, err error) {
 
 	var dir string
@@ -248,7 +246,7 @@
 				messages = append(messages,
 					fmt.Sprintf("'meta.json' found but invalid: %v", err))
 			} else {
-				errs := meta.Validate(req.Context(), conn)
+				errs := meta.Validate(req.Context(), JSONConn(req))
 				for _, err := range errs {
 					messages = append(messages,
 						fmt.Sprintf("invalid 'meta.json': %v", err))