Mercurial > gemma
comparison pkg/imports/agm.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 | 1b1cb6cbfbf0 |
children | de4dc3d16647 |
comparison
equal
deleted
inserted
replaced
2186:d0498088894f | 2187:7c83b5277c1c |
---|---|
26 "path/filepath" | 26 "path/filepath" |
27 "strconv" | 27 "strconv" |
28 "strings" | 28 "strings" |
29 "time" | 29 "time" |
30 | 30 |
31 "gemma.intevation.de/gemma/pkg/common" | |
32 "gemma.intevation.de/gemma/pkg/misc" | 31 "gemma.intevation.de/gemma/pkg/misc" |
33 "gemma.intevation.de/gemma/pkg/models" | 32 "gemma.intevation.de/gemma/pkg/models" |
34 ) | 33 ) |
35 | 34 |
36 type ApprovedGaugeMeasurements struct { | 35 type ApprovedGaugeMeasurements struct { |
50 | 49 |
51 func (agmJobCreator) Description() string { | 50 func (agmJobCreator) Description() string { |
52 return "approved gauge measurements" | 51 return "approved gauge measurements" |
53 } | 52 } |
54 | 53 |
55 func (agmJobCreator) Create(data string) (Job, error) { | 54 func (agmJobCreator) Create() Job { return new(ApprovedGaugeMeasurements) } |
56 agm := new(ApprovedGaugeMeasurements) | |
57 if err := common.FromJSONString(data, agm); err != nil { | |
58 return nil, err | |
59 } | |
60 return agm, nil | |
61 } | |
62 | 55 |
63 func (agmJobCreator) Depends() []string { | 56 func (agmJobCreator) Depends() []string { |
64 return []string{ | 57 return []string{ |
65 "gauges", | 58 "gauges", |
66 "gauge_measurements", | 59 "gauge_measurements", |