diff pkg/imports/config.go @ 1704:897d4d8316ad

Import configuration: Made extra attributes updatable, too.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 07 Jan 2019 15:34:34 +0100
parents 49b89575ab31
children dcbe2a7dc532
line wrap: on
line diff
--- a/pkg/imports/config.go	Mon Jan 07 13:30:29 2019 +0100
+++ b/pkg/imports/config.go	Mon Jan 07 15:34:34 2019 +0100
@@ -34,7 +34,7 @@
 
 	// ConfigAttributes is a map of optional key/value attributes
 	// of an import configuration.
-	ConfigAttributes map[string]*string
+	ConfigAttributes map[string]string
 
 	// Config is JSON serialized form of a import configuration.
 	Config struct {
@@ -79,10 +79,8 @@
 	if ca == nil {
 		return "", false
 	}
-	if value, found := ca[key]; found && value != nil {
-		return *value, true
-	}
-	return "", false
+	value, found := ca[key]
+	return value, found
 }
 
 // UnmarshalJSON checks if the incoming string
@@ -169,16 +167,16 @@
 			return err
 		}
 		defer rows.Close()
-		var attributes map[string]*string
+		var attributes map[string]string
 		for rows.Next() {
 			var k, v string
 			if err = rows.Scan(&k, &v); err != nil {
 				return err
 			}
 			if attributes == nil {
-				attributes = map[string]*string{}
+				attributes = map[string]string{}
 			}
-			attributes[k] = &v
+			attributes[k] = v
 		}
 		if err = rows.Err(); err != nil {
 			return err