Mercurial > gemma
diff pkg/models/common.go @ 4332:8080007d3c06
shape upload stretch import: Finished implementation (staging, summary).
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 05 Sep 2019 10:32:45 +0200 |
parents | 97bba8b51b9c |
children | 4847ac70103a |
line wrap: on
line diff
--- a/pkg/models/common.go Thu Sep 05 09:29:15 2019 +0200 +++ b/pkg/models/common.go Thu Sep 05 10:32:45 2019 +0200 @@ -81,6 +81,16 @@ } ) +// Valid checks if the given country is a known one. +func (c Country) Valid() bool { + for _, v := range validCountries { + if string(c) == v { + return true + } + } + return false +} + // UnmarshalJSON ensures that the given string forms a valid // two letter country code. func (c *Country) UnmarshalJSON(data []byte) error {