cfger/types.go
2023-08-21 16:47:32 +01:00

27 lines
351 B
Go

package cfger
type OptionalItem struct {
item any
found bool
}
func (x OptionalItem) AsInt() int {
if !x.found {
return 0
}
return x.item.(int)
}
func (x OptionalItem) AsString() string {
if !x.found {
return ""
}
return x.item.(string)
}
func (x OptionalItem) AsBool() bool {
if !x.found {
return false
}
return x.item.(bool)
}