package db import "strings" func IsLocationTypeValid(l string) bool { var validLocationTypes = []LocationType{ LocationTypeAmusementpark, LocationTypeBeach, LocationTypeCulinary, LocationTypeHikingCamping, LocationTypeOther, } lTypes := strings.Split(l, ",") for _, v := range validLocationTypes { for _, k := range lTypes { if v != LocationType(k) { return false } } } return true }