comparison pkg/imports/sec.go @ 4062:6c760abcff0e

Move handling of PostgreSQL errors to own package
author Tom Gottfried <tom@intevation.de>
date Thu, 25 Jul 2019 11:32:22 +0200
parents 6c5c15b2fb64
children fe3dd65c0891
comparison
equal deleted inserted replaced
4061:f391497287fb 4062:6c760abcff0e
16 import ( 16 import (
17 "context" 17 "context"
18 "database/sql" 18 "database/sql"
19 "time" 19 "time"
20 20
21 "gemma.intevation.de/gemma/pkg/common"
22 "gemma.intevation.de/gemma/pkg/models" 21 "gemma.intevation.de/gemma/pkg/models"
22 "gemma.intevation.de/gemma/pkg/pgxutils"
23 ) 23 )
24 24
25 type Section struct { 25 type Section struct {
26 Name string `json:"name"` 26 Name string `json:"name"`
27 From models.Isrs `json:"from"` 27 From models.Isrs `json:"from"`
180 nobjnm, 180 nobjnm,
181 sec.Date.Time, 181 sec.Date.Time,
182 sec.Source, 182 sec.Source,
183 sec.Tolerance, 183 sec.Tolerance,
184 ).Scan(&id); err != nil { 184 ).Scan(&id); err != nil {
185 return nil, common.HandlePGError(err) 185 return nil, pgxutils.HandlePGError(err)
186 } 186 }
187 187
188 if err := track(ctx, tx, importID, "waterway.sections", id); err != nil { 188 if err := track(ctx, tx, importID, "waterway.sections", id); err != nil {
189 return nil, err 189 return nil, err
190 } 190 }