changeset 4939:39b67b910204 fairway-marks-import

Make getFMInsertSQL variadic
author Tom Gottfried <tom@intevation.de>
date Mon, 17 Feb 2020 15:14:24 +0100
parents 9f9d72a1d398
children b3b2ba09a450
files pkg/imports/fm.go pkg/imports/fm_bcnlat.go pkg/imports/fm_boycar.go pkg/imports/fm_boylat.go
diffstat 4 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/fm.go	Mon Feb 17 14:47:54 2020 +0100
+++ b/pkg/imports/fm.go	Mon Feb 17 15:14:24 2020 +0100
@@ -101,7 +101,7 @@
 )
 
 // Create INSERT statement for specific fairway marks type
-func getFMInsertSQL(fmType string, attributes []string) string {
+func getFMInsertSQL(fmType string, attributes ...string) string {
 	attNums := "$16"
 	for i := 1; i < len(attributes); i++ {
 		attNums += fmt.Sprintf(",$%d", 16+i)
--- a/pkg/imports/fm_bcnlat.go	Mon Feb 17 14:47:54 2020 +0100
+++ b/pkg/imports/fm_bcnlat.go	Mon Feb 17 15:14:24 2020 +0100
@@ -111,8 +111,8 @@
 
 			insertStmt, err := tx.PrepareContext(
 				ctx,
-				getFMInsertSQL("bcnlat", []string{
-					"colour", "colpat", "condtn", "bcnshp", "catlam"}),
+				getFMInsertSQL("bcnlat",
+					"colour", "colpat", "condtn", "bcnshp", "catlam"),
 			)
 			if err != nil {
 				return
--- a/pkg/imports/fm_boycar.go	Mon Feb 17 14:47:54 2020 +0100
+++ b/pkg/imports/fm_boycar.go	Mon Feb 17 15:14:24 2020 +0100
@@ -102,9 +102,9 @@
 
 			insertStmt, err := tx.PrepareContext(
 				ctx,
-				getFMInsertSQL("boycar", []string{
+				getFMInsertSQL("boycar",
 					"colour", "colpat", "conrad",
-					"marsys", "boyshp", "catcam"}),
+					"marsys", "boyshp", "catcam"),
 			)
 			if err != nil {
 				return
--- a/pkg/imports/fm_boylat.go	Mon Feb 17 14:47:54 2020 +0100
+++ b/pkg/imports/fm_boylat.go	Mon Feb 17 15:14:24 2020 +0100
@@ -104,9 +104,9 @@
 
 			insertStmt, err := tx.PrepareContext(
 				ctx,
-				getFMInsertSQL("boylat", []string{
+				getFMInsertSQL("boylat",
 					"colour", "colpat", "conrad",
-					"marsys", "boyshp", "catlam"}),
+					"marsys", "boyshp", "catlam"),
 			)
 			if err != nil {
 				return