comparison pkg/imports/wp.go @ 4182:49012340336c

Made 'golint' finally happy with imports package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 06 Aug 2019 11:13:28 +0200
parents 8b75ac5e243e
children ca6a5f722471
comparison
equal deleted inserted replaced
4181:bd97dc2dceea 4182:49012340336c
37 37
38 // defaultPointToLinePrecision is the precision in meters 38 // defaultPointToLinePrecision is the precision in meters
39 // to match from points to lines. 39 // to match from points to lines.
40 const defaultPointToLinePrecision = 10 40 const defaultPointToLinePrecision = 10
41 41
42 // WaterwayProfiles is a Job to import waterway profiles
43 // from a given WFS service plus some uploaded CSV file
44 // and stores them into the database.
42 type WaterwayProfiles struct { 45 type WaterwayProfiles struct {
43 Dir string `json:"dir"` 46 Dir string `json:"dir"`
44 // URL the GetCapabilities URL of the WFS service. 47 // URL the GetCapabilities URL of the WFS service.
45 URL string `json:"url"` 48 URL string `json:"url"`
46 // FeatureType selects the feature type of the WFS service. 49 // FeatureType selects the feature type of the WFS service.
54 User string `json:"user,omitempty"` 57 User string `json:"user,omitempty"`
55 // Password is an optional password for Basic Auth. 58 // Password is an optional password for Basic Auth.
56 Password string `json:"password,omitempty"` 59 Password string `json:"password,omitempty"`
57 } 60 }
58 61
62 // WPJobKind is the unique name of this import job type.
59 const WPJobKind JobKind = "wp" 63 const WPJobKind JobKind = "wp"
60 64
61 type wpJobCreator struct{} 65 type wpJobCreator struct{}
62 66
63 func init() { 67 func init() {
147 ) error { 151 ) error {
148 _, err := tx.ExecContext(ctx, wpStageDoneSQL, id) 152 _, err := tx.ExecContext(ctx, wpStageDoneSQL, id)
149 return err 153 return err
150 } 154 }
151 155
152 func (wp *WaterwayProfiles) CleanUp() error { 156 // CleanUp deletes temporary files from the filesystem.
153 return os.RemoveAll(wp.Dir) 157 func (wp *WaterwayProfiles) CleanUp() error { return os.RemoveAll(wp.Dir) }
154 } 158
155 159 // Do performs the actual import.
156 func (wp *WaterwayProfiles) Do( 160 func (wp *WaterwayProfiles) Do(
157 ctx context.Context, 161 ctx context.Context,
158 importID int64, 162 importID int64,
159 conn *sql.Conn, 163 conn *sql.Conn,
160 feedback Feedback, 164 feedback Feedback,