Overview
Enum types often have specific values they can take. For example, DiskBackendType can only be "local" or "distributed". When receiving external input, it is useful to validate that a value is actually a valid enum variant, so the SDK could provide validation methods like:
func (v DiskBackendType) Valid() bool {
switch v {
case DiskBackendTypeLocal, DiskBackendTypeDistributed:
return true
}
return false
}
Now users can just cast an input and have the SDK validate it:
t := oxide.DiskBackendType(input)
if !t.Valid() {
return fmt.Errorf("invalid disk type")
}
Implementation details
No response
Anything else you would like to add?
No response
Overview
Enum types often have specific values they can take. For example,
DiskBackendTypecan only be"local"or"distributed". When receiving external input, it is useful to validate that a value is actually a valid enum variant, so the SDK could provide validation methods like:Now users can just cast an input and have the SDK validate it:
Implementation details
No response
Anything else you would like to add?
No response