comparison pkg/imports/wg.go @ 2187:7c83b5277c1c

Import queue: Removed boilerplate code to deserialize jobs from JSON by making it part of the import queue.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 11 Feb 2019 18:35:01 +0100
parents b868cb653c4d
children 8a8680e70d2e
comparison
equal deleted inserted replaced
2186:d0498088894f 2187:7c83b5277c1c
21 "strings" 21 "strings"
22 "time" 22 "time"
23 23
24 "github.com/jackc/pgx/pgtype" 24 "github.com/jackc/pgx/pgtype"
25 25
26 "gemma.intevation.de/gemma/pkg/common"
27 "gemma.intevation.de/gemma/pkg/models" 26 "gemma.intevation.de/gemma/pkg/models"
28 "gemma.intevation.de/gemma/pkg/soap" 27 "gemma.intevation.de/gemma/pkg/soap"
29 "gemma.intevation.de/gemma/pkg/soap/erdms" 28 "gemma.intevation.de/gemma/pkg/soap/erdms"
30 ) 29 )
31 30
51 50
52 func (wgJobCreator) Description() string { return "waterway gauges" } 51 func (wgJobCreator) Description() string { return "waterway gauges" }
53 52
54 func (wgJobCreator) AutoAccept() bool { return true } 53 func (wgJobCreator) AutoAccept() bool { return true }
55 54
56 func (wgJobCreator) Create(data string) (Job, error) { 55 func (wgJobCreator) Create() Job { return new(WaterwayGauge) }
57 wg := new(WaterwayGauge)
58 if err := common.FromJSONString(data, wg); err != nil {
59 return nil, err
60 }
61 return wg, nil
62 }
63 56
64 func (wgJobCreator) Depends() []string { 57 func (wgJobCreator) Depends() []string {
65 return []string{ 58 return []string{
66 "gauges", 59 "gauges",
67 "gauges_reference_water_levels", 60 "gauges_reference_water_levels",