comparison pkg/imports/bn.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 3437ceee1529
comparison
equal deleted inserted replaced
2186:d0498088894f 2187:7c83b5277c1c
19 "errors" 19 "errors"
20 "regexp" 20 "regexp"
21 "strconv" 21 "strconv"
22 "time" 22 "time"
23 23
24 "gemma.intevation.de/gemma/pkg/common"
25 "gemma.intevation.de/gemma/pkg/soap/ifbn" 24 "gemma.intevation.de/gemma/pkg/soap/ifbn"
26 ) 25 )
27 26
28 // Bottleneck is an import job to import 27 // Bottleneck is an import job to import
29 // bottlenecks from an IFBN SOAP service. 28 // bottlenecks from an IFBN SOAP service.
86 85
87 func (bnJobCreator) Description() string { return "bottlenecks" } 86 func (bnJobCreator) Description() string { return "bottlenecks" }
88 87
89 func (bnJobCreator) AutoAccept() bool { return false } 88 func (bnJobCreator) AutoAccept() bool { return false }
90 89
91 func (bnJobCreator) Create(data string) (Job, error) { 90 func (bnJobCreator) Create() Job { return new(Bottleneck) }
92 bn := new(Bottleneck)
93 if err := common.FromJSONString(data, bn); err != nil {
94 return nil, err
95 }
96 return bn, nil
97 }
98 91
99 func (bnJobCreator) Depends() []string { 92 func (bnJobCreator) Depends() []string {
100 return []string{ 93 return []string{
101 "gauges", 94 "gauges",
102 "bottlenecks", 95 "bottlenecks",