comparison pkg/imports/wx.go @ 1675:8fec3887c7e5

Waterway axis import: Added stub.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 26 Dec 2018 10:25:49 +0100
parents
children 53304db85888
comparison
equal deleted inserted replaced
1674:54f7493e5d36 1675:8fec3887c7e5
1 // This is Free Software under GNU Affero General Public License v >= 3.0
2 // without warranty, see README.md and license for details.
3 //
4 // SPDX-License-Identifier: AGPL-3.0-or-later
5 // License-Filename: LICENSES/AGPL-3.0.txt
6 //
7 // Copyright (C) 2018 by via donau
8 // – Österreichische Wasserstraßen-Gesellschaft mbH
9 // Software engineering by Intevation GmbH
10 //
11 // Author(s):
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de>
13
14 package imports
15
16 import (
17 "context"
18 "database/sql"
19
20 "gemma.intevation.de/gemma/pkg/common"
21 )
22
23 type WaterwayAxis struct {
24 URL string `json:"url"`
25 SortBy string `json:"sort-by"`
26 }
27
28 const WXJobKind JobKind = "wx"
29
30 type wxJobCreator struct{}
31
32 func init() {
33 RegisterJobCreator(WXJobKind, wxJobCreator{})
34 }
35
36 func (wxJobCreator) Description() string {
37 return "waterway axis"
38 }
39
40 func (wxJobCreator) Create(_ JobKind, data string) (Job, error) {
41 wx := new(WaterwayAxis)
42 if err := common.FromJSONString(data, wx); err != nil {
43 return nil, err
44 }
45 return wx, nil
46 }
47
48 func (wxJobCreator) Depends() []string {
49 return []string{
50 "waterway_axis",
51 }
52 }
53
54 // StageDone is a NOP for waterway axis imports.
55 func (wxJobCreator) StageDone(context.Context, *sql.Tx, int64) error {
56 return nil
57 }
58
59 // CleanUp for waterway imports is a NOP.
60 func (*WaterwayAxis) CleanUp() error { return nil }
61
62 // Do executes the actual waterway exis import.
63 func (wx *WaterwayAxis) Do(
64 ctx context.Context,
65 importID int64,
66 conn *sql.Conn,
67 feedback Feedback,
68 ) (interface{}, error) {
69
70 // TODO: Implement me!
71 return nil, nil
72 }