diff pkg/models/user.go @ 1901:71b722809b2b

Stretch import: Added stub.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 18 Jan 2019 15:52:51 +0100
parents f1c3fe8b79f5
children 4847ac70103a
line wrap: on
line diff
--- a/pkg/models/user.go	Fri Jan 18 15:04:53 2019 +0100
+++ b/pkg/models/user.go	Fri Jan 18 15:52:51 2019 +0100
@@ -25,8 +25,6 @@
 type (
 	// Email is a string formed by a valid EMail address.
 	Email string
-	// Country is a valid country 2 letter code.
-	Country string
 	// Role is a string with a valid gemma role.
 	Role string
 	// UserName is a string forming a valid user name.
@@ -132,46 +130,6 @@
 }
 
 var (
-	validCountries = []string{
-		"AT", "BG", "DE", "HU", "HR",
-		"MD", "RO", "RS", "SK", "UA",
-	}
-	errNoValidCountry = errors.New("Not a valid country")
-)
-
-// UnmarshalJSON ensures that the given string forms a valid
-// two letter country code.
-func (c *Country) UnmarshalJSON(data []byte) error {
-	var s string
-	if err := json.Unmarshal(data, &s); err != nil {
-		return err
-	}
-	s = strings.ToUpper(s)
-	for _, v := range validCountries {
-		if v == s {
-			*c = Country(v)
-			return nil
-		}
-	}
-	return errNoValidCountry
-}
-
-// Value implements the driver.Valuer interface.
-func (c Country) Value() (driver.Value, error) {
-	return string(c), nil
-}
-
-// Scan implements the sql.Scanner interfaces.
-func (c *Country) Scan(src interface{}) (err error) {
-	if s, ok := src.(string); ok {
-		*c = Country(s)
-	} else {
-		err = errNoString
-	}
-	return
-}
-
-var (
 	validRoles = []string{
 		"waterway_user",
 		"waterway_admin",