hiling_go/db/sqlc/helper.go

26 lines
419 B
Go
Raw Permalink Normal View History

2024-08-19 07:40:01 +07:00
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
}