comparison pkg/controllers/diff.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 cb4fda122321
children d776110b4db0
comparison
equal deleted inserted replaced
4240:a4f76e170290 4242:1458c9b0fdaa
85 var diffCalculationSemaphore = semaphore.NewWeighted(int64(3)) 85 var diffCalculationSemaphore = semaphore.NewWeighted(int64(3))
86 86
87 func diffCalculation( 87 func diffCalculation(
88 input interface{}, 88 input interface{},
89 req *http.Request, 89 req *http.Request,
90 conn *sql.Conn,
91 ) (jr JSONResult, err error) { 90 ) (jr JSONResult, err error) {
92 91
93 begin := time.Now() 92 begin := time.Now()
94 start := begin 93 start := begin
95 94
96 dci := input.(*models.DiffCalculationInput) 95 dci := input.(*models.DiffCalculationInput)
97 96
98 ctx := req.Context() 97 ctx := req.Context()
98
99 conn := JSONConn(req)
99 100
100 var id int64 101 var id int64
101 err = conn.QueryRowContext( 102 err = conn.QueryRowContext(
102 ctx, 103 ctx,
103 diffIDSQL, 104 diffIDSQL,