evcc-io/util/templates/paramtype.go
2024-01-27 13:38:16 +01:00

27 lines
477 B
Go

package templates
type ParamType int
func (c *ParamType) UnmarshalText(text []byte) error {
typ, err := ParamTypeString(string(text))
if err == nil {
*c = typ
}
return err
}
func (c ParamType) MarshalText() ([]byte, error) {
return []byte(c.String()), nil
}
//go:generate enumer -type ParamType -trimprefix Type
const (
TypeString ParamType = iota // default type string
TypeBool
TypeChoice
TypeChargeModes
TypeDuration
TypeFloat
TypeNumber
TypeStringList
)