Mercurial > gemma
comparison pkg/imports/st.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 | 97bba8b51b9c |
comparison
equal
deleted
inserted
replaced
2186:d0498088894f | 2187:7c83b5277c1c |
---|---|
17 "context" | 17 "context" |
18 "database/sql" | 18 "database/sql" |
19 "errors" | 19 "errors" |
20 "time" | 20 "time" |
21 | 21 |
22 "gemma.intevation.de/gemma/pkg/common" | |
23 "gemma.intevation.de/gemma/pkg/models" | 22 "gemma.intevation.de/gemma/pkg/models" |
24 ) | 23 ) |
25 | 24 |
26 type Stretch struct { | 25 type Stretch struct { |
27 Name string `json:"name"` | 26 Name string `json:"name"` |
44 | 43 |
45 func (stJobCreator) Description() string { return "stretch" } | 44 func (stJobCreator) Description() string { return "stretch" } |
46 | 45 |
47 func (stJobCreator) AutoAccept() bool { return false } | 46 func (stJobCreator) AutoAccept() bool { return false } |
48 | 47 |
49 func (stJobCreator) Create(data string) (Job, error) { | 48 func (stJobCreator) Create() Job { return new(Stretch) } |
50 st := new(Stretch) | |
51 if err := common.FromJSONString(data, st); err != nil { | |
52 return nil, err | |
53 } | |
54 return st, nil | |
55 } | |
56 | 49 |
57 func (stJobCreator) Depends() []string { | 50 func (stJobCreator) Depends() []string { |
58 return []string{ | 51 return []string{ |
59 "stretches", | 52 "stretches", |
60 } | 53 } |