Mercurial > gemma
comparison pkg/imports/dma.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 | 02505fcff63c |
comparison
equal
deleted
inserted
replaced
2186:d0498088894f | 2187:7c83b5277c1c |
---|---|
20 "errors" | 20 "errors" |
21 "fmt" | 21 "fmt" |
22 "io" | 22 "io" |
23 "time" | 23 "time" |
24 | 24 |
25 "gemma.intevation.de/gemma/pkg/common" | |
26 "gemma.intevation.de/gemma/pkg/wfs" | 25 "gemma.intevation.de/gemma/pkg/wfs" |
27 ) | 26 ) |
28 | 27 |
29 // FairwayDimension is an import job to import | 28 // FairwayDimension is an import job to import |
30 // the fairway dimensions in form of polygon geometries | 29 // the fairway dimensions in form of polygon geometries |
49 | 48 |
50 func (dmaJobCreator) Description() string { return "distance marks" } | 49 func (dmaJobCreator) Description() string { return "distance marks" } |
51 | 50 |
52 func (dmaJobCreator) AutoAccept() bool { return true } | 51 func (dmaJobCreator) AutoAccept() bool { return true } |
53 | 52 |
54 func (dmaJobCreator) Create(data string) (Job, error) { | 53 func (dmaJobCreator) Create() Job { return new(DistanceMarksAshore) } |
55 dma := new(DistanceMarksAshore) | |
56 if err := common.FromJSONString(data, dma); err != nil { | |
57 return nil, err | |
58 } | |
59 return dma, nil | |
60 } | |
61 | 54 |
62 func (dmaJobCreator) Depends() []string { | 55 func (dmaJobCreator) Depends() []string { |
63 return []string{ | 56 return []string{ |
64 "distance_marks", | 57 "distance_marks", |
65 } | 58 } |