diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pkg/imports/wx.go	Wed Dec 26 10:25:49 2018 +0100
@@ -0,0 +1,72 @@
+// This is Free Software under GNU Affero General Public License v >= 3.0
+// without warranty, see README.md and license for details.
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// License-Filename: LICENSES/AGPL-3.0.txt
+//
+// Copyright (C) 2018 by via donau
+//   – Österreichische Wasserstraßen-Gesellschaft mbH
+// Software engineering by Intevation GmbH
+//
+// Author(s):
+//  * Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+package imports
+
+import (
+	"context"
+	"database/sql"
+
+	"gemma.intevation.de/gemma/pkg/common"
+)
+
+type WaterwayAxis struct {
+	URL    string `json:"url"`
+	SortBy string `json:"sort-by"`
+}
+
+const WXJobKind JobKind = "wx"
+
+type wxJobCreator struct{}
+
+func init() {
+	RegisterJobCreator(WXJobKind, wxJobCreator{})
+}
+
+func (wxJobCreator) Description() string {
+	return "waterway axis"
+}
+
+func (wxJobCreator) Create(_ JobKind, data string) (Job, error) {
+	wx := new(WaterwayAxis)
+	if err := common.FromJSONString(data, wx); err != nil {
+		return nil, err
+	}
+	return wx, nil
+}
+
+func (wxJobCreator) Depends() []string {
+	return []string{
+		"waterway_axis",
+	}
+}
+
+// StageDone is a NOP for waterway axis imports.
+func (wxJobCreator) StageDone(context.Context, *sql.Tx, int64) error {
+	return nil
+}
+
+// CleanUp for waterway imports is a NOP.
+func (*WaterwayAxis) CleanUp() error { return nil }
+
+// Do executes the actual waterway exis import.
+func (wx *WaterwayAxis) Do(
+	ctx context.Context,
+	importID int64,
+	conn *sql.Conn,
+	feedback Feedback,
+) (interface{}, error) {
+
+	// TODO: Implement me!
+	return nil, nil
+}