Mercurial > gemma
diff pkg/imports/stsh.go @ 4311:f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 03 Sep 2019 13:02:09 +0200 |
parents | |
children | 5da02dcc51f6 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/imports/stsh.go Tue Sep 03 13:02:09 2019 +0200 @@ -0,0 +1,66 @@ +// 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) 2019 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" + "os" +) + +type StretchShape struct { + Dir string `json:"dir"` +} + +const STSHJobKind JobKind = "stsh" + +type stshJobCreator struct{} + +func init() { RegisterJobCreator(STSHJobKind, stshJobCreator{}) } + +func (stshJobCreator) Description() string { return "stretch from shape" } + +func (stshJobCreator) AutoAccept() bool { return false } + +func (stshJobCreator) Create() Job { return new(StretchShape) } + +func (stshJobCreator) Depends() [2][]string { + return [2][]string{ + {"stretches", "stretch_countries"}, + {}, + } +} + +func (stshJobCreator) StageDone( + ctx context.Context, + tx *sql.Tx, + id int64, +) error { + // TODO: Implement me! + return nil +} + +func (stsh *StretchShape) CleanUp() error { + return os.RemoveAll(stsh.Dir) +} + +func (stsh *StretchShape) Do( + ctx context.Context, + importID int64, + conn *sql.Conn, + feedback Feedback, +) (interface{}, error) { + // TODO: Implement me! + return nil, nil +}