Say I have a const type and corresponding sub types -
type Animaltype int32
const (
dogs Animaltype = iota
cats
)
type dogtype int32
const (
retriever dogtype = iota
whippet
)
type cattype int32
const (
siamese cattype = iota
tabby
)
I'd like a structure that holds the animal type and then a field that flexibly holds the subtype
type AnimalCount struct {
category Animaltype
subcategory map[dogtype]int32
}
But where I have dogtype for sub category I'd like it to be dogtype or cattype. For eg here I have I would be mapping the subtype to the count of that type
Is this possible in go?