Mercurial > gemma
comparison pkg/imports/stsh.go @ 4852:046a07a33b19
Fixed the golint issues of the imports package.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 19 Nov 2019 16:08:55 +0100 |
parents | e020e6e34ad7 |
children | e4ab338e7ba9 |
comparison
equal
deleted
inserted
replaced
4851:faabfed7f0e9 | 4852:046a07a33b19 |
---|---|
29 | 29 |
30 "gemma.intevation.de/gemma/pkg/common" | 30 "gemma.intevation.de/gemma/pkg/common" |
31 "gemma.intevation.de/gemma/pkg/models" | 31 "gemma.intevation.de/gemma/pkg/models" |
32 ) | 32 ) |
33 | 33 |
34 // StretchShape imports stretches from an uploaded shape file. | |
34 type StretchShape struct { | 35 type StretchShape struct { |
35 Dir string `json:"dir"` | 36 Dir string `json:"dir"` |
36 } | 37 } |
37 | 38 |
39 // STSHJobKind is the import queue type identifier. | |
38 const STSHJobKind JobKind = "stsh" | 40 const STSHJobKind JobKind = "stsh" |
39 | 41 |
40 type stshJobCreator struct{} | 42 type stshJobCreator struct{} |
41 | 43 |
42 func init() { RegisterJobCreator(STSHJobKind, stshJobCreator{}) } | 44 func init() { RegisterJobCreator(STSHJobKind, stshJobCreator{}) } |
82 id int64, | 84 id int64, |
83 ) error { | 85 ) error { |
84 return stJobCreator{}.StageDone(ctx, tx, id) | 86 return stJobCreator{}.StageDone(ctx, tx, id) |
85 } | 87 } |
86 | 88 |
89 // CleanUp removes the folder with the uploaded shape file. | |
87 func (stsh *StretchShape) CleanUp() error { | 90 func (stsh *StretchShape) CleanUp() error { |
88 return os.RemoveAll(stsh.Dir) | 91 return os.RemoveAll(stsh.Dir) |
89 } | 92 } |
90 | 93 |
91 func fixAttribute(s string) string { | 94 func fixAttribute(s string) string { |
121 unique[n] = struct{}{} | 124 unique[n] = struct{}{} |
122 } | 125 } |
123 return countries, nil | 126 return countries, nil |
124 } | 127 } |
125 | 128 |
129 // Do executes the actual stretch import from the shape file. | |
126 func (stsh *StretchShape) Do( | 130 func (stsh *StretchShape) Do( |
127 ctx context.Context, | 131 ctx context.Context, |
128 importID int64, | 132 importID int64, |
129 conn *sql.Conn, | 133 conn *sql.Conn, |
130 feedback Feedback, | 134 feedback Feedback, |