Mercurial > gemma
comparison 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 |
comparison
equal
deleted
inserted
replaced
4310:3d6941046858 | 4311:f9bb06f2dbe3 |
---|---|
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) 2019 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 "os" | |
20 ) | |
21 | |
22 type StretchShape struct { | |
23 Dir string `json:"dir"` | |
24 } | |
25 | |
26 const STSHJobKind JobKind = "stsh" | |
27 | |
28 type stshJobCreator struct{} | |
29 | |
30 func init() { RegisterJobCreator(STSHJobKind, stshJobCreator{}) } | |
31 | |
32 func (stshJobCreator) Description() string { return "stretch from shape" } | |
33 | |
34 func (stshJobCreator) AutoAccept() bool { return false } | |
35 | |
36 func (stshJobCreator) Create() Job { return new(StretchShape) } | |
37 | |
38 func (stshJobCreator) Depends() [2][]string { | |
39 return [2][]string{ | |
40 {"stretches", "stretch_countries"}, | |
41 {}, | |
42 } | |
43 } | |
44 | |
45 func (stshJobCreator) StageDone( | |
46 ctx context.Context, | |
47 tx *sql.Tx, | |
48 id int64, | |
49 ) error { | |
50 // TODO: Implement me! | |
51 return nil | |
52 } | |
53 | |
54 func (stsh *StretchShape) CleanUp() error { | |
55 return os.RemoveAll(stsh.Dir) | |
56 } | |
57 | |
58 func (stsh *StretchShape) Do( | |
59 ctx context.Context, | |
60 importID int64, | |
61 conn *sql.Conn, | |
62 feedback Feedback, | |
63 ) (interface{}, error) { | |
64 // TODO: Implement me! | |
65 return nil, nil | |
66 } |