# HG changeset patch # User Sascha L. Teichmann # Date 1565082808 -7200 # Node ID 49012340336c4ef74141491c057e83a6eb3b9d4a # Parent bd97dc2dceeae9425ec58cbe2985bb6988476c79 Made 'golint' finally happy with imports package. diff -r bd97dc2dceea -r 49012340336c pkg/imports/sr.go --- a/pkg/imports/sr.go Mon Aug 05 18:32:54 2019 +0200 +++ b/pkg/imports/sr.go Tue Aug 06 11:13:28 2019 +0200 @@ -73,7 +73,7 @@ pointsPerSquareMeter = 2 ) -// SRJobKind is the unique name of a SoundingResult import job. +// SRJobKind is the unique name of this import job type. const SRJobKind JobKind = "sr" type srJobCreator struct{} diff -r bd97dc2dceea -r 49012340336c pkg/imports/ufa.go --- a/pkg/imports/ufa.go Mon Aug 05 18:32:54 2019 +0200 +++ b/pkg/imports/ufa.go Tue Aug 06 11:13:28 2019 +0200 @@ -24,10 +24,14 @@ "gemma.intevation.de/gemma/pkg/soap/ifaf" ) +// UploadedFairwayAvailability is Job to extract +// fairway availability data from an XML file and stores +// it into the database. type UploadedFairwayAvailability struct { Dir string } +// UFAJobKind is the unique name of this import job type. const UFAJobKind JobKind = "ufa" type ufaJobCreator struct{} @@ -51,6 +55,7 @@ return nil } +// CleanUp removes the temporary files from the filesystem. func (ufa *UploadedFairwayAvailability) CleanUp() error { return os.RemoveAll(ufa.Dir) } diff -r bd97dc2dceea -r 49012340336c pkg/imports/ugm.go --- a/pkg/imports/ugm.go Mon Aug 05 18:32:54 2019 +0200 +++ b/pkg/imports/ugm.go Tue Aug 06 11:13:28 2019 +0200 @@ -24,10 +24,13 @@ "gemma.intevation.de/gemma/pkg/soap/nts" ) +// UploadedGaugeMeasurement is an Jon to extract gauge measurement data +// from an uploaded XML file and stores it into the database. type UploadedGaugeMeasurement struct { Dir string `json:"dir"` } +// UGMJobKind is the unique name of this import job type. const UGMJobKind JobKind = "ugm" type ugmJobCreator struct{} @@ -44,6 +47,7 @@ func (ugmJobCreator) StageDone(context.Context, *sql.Tx, int64) error { return nil } +// CleanUp removes the temporary files from the filesystem. func (ugm *UploadedGaugeMeasurement) CleanUp() error { return os.RemoveAll(ugm.Dir) } // Do executes the actual uploaded gauge measurement import. diff -r bd97dc2dceea -r 49012340336c pkg/imports/wg.go --- a/pkg/imports/wg.go Mon Aug 05 18:32:54 2019 +0200 +++ b/pkg/imports/wg.go Tue Aug 06 11:13:28 2019 +0200 @@ -26,6 +26,8 @@ "gemma.intevation.de/gemma/pkg/soap/erdms" ) +// WaterwayGauge is a Job to load gauge data from +// a specified NTS service and stores them into the database. type WaterwayGauge struct { // URL is the URL of the SOAP service. URL string `json:"url"` @@ -38,13 +40,12 @@ Insecure bool `json:"insecure"` } +// WGJobKind is the unique name of this import job type. const WGJobKind JobKind = "wg" type wgJobCreator struct{} -func init() { - RegisterJobCreator(WGJobKind, wgJobCreator{}) -} +func init() { RegisterJobCreator(WGJobKind, wgJobCreator{}) } func (wgJobCreator) Description() string { return "waterway gauges" } @@ -171,6 +172,7 @@ ` ) +// Do implements the actual import. func (wg *WaterwayGauge) Do( ctx context.Context, importID int64, diff -r bd97dc2dceea -r 49012340336c pkg/imports/wp.go --- a/pkg/imports/wp.go Mon Aug 05 18:32:54 2019 +0200 +++ b/pkg/imports/wp.go Tue Aug 06 11:13:28 2019 +0200 @@ -39,6 +39,9 @@ // to match from points to lines. const defaultPointToLinePrecision = 10 +// WaterwayProfiles is a Job to import waterway profiles +// from a given WFS service plus some uploaded CSV file +// and stores them into the database. type WaterwayProfiles struct { Dir string `json:"dir"` // URL the GetCapabilities URL of the WFS service. @@ -56,6 +59,7 @@ Password string `json:"password,omitempty"` } +// WPJobKind is the unique name of this import job type. const WPJobKind JobKind = "wp" type wpJobCreator struct{} @@ -149,10 +153,10 @@ return err } -func (wp *WaterwayProfiles) CleanUp() error { - return os.RemoveAll(wp.Dir) -} +// CleanUp deletes temporary files from the filesystem. +func (wp *WaterwayProfiles) CleanUp() error { return os.RemoveAll(wp.Dir) } +// Do performs the actual import. func (wp *WaterwayProfiles) Do( ctx context.Context, importID int64,