github.com/jordan-bonecutter/can-go@v0.0.0-20230901155856-d83995b18e50/pkg/dbc/attributevaluetype.go (about) 1 package dbc 2 3 import "fmt" 4 5 // AttributeValueType represents an attribute value type. 6 type AttributeValueType string 7 8 const ( 9 AttributeValueTypeInt AttributeValueType = "INT" 10 AttributeValueTypeHex AttributeValueType = "HEX" 11 AttributeValueTypeFloat AttributeValueType = "FLOAT" 12 AttributeValueTypeString AttributeValueType = "STRING" 13 AttributeValueTypeEnum AttributeValueType = "ENUM" 14 ) 15 16 // Validate returns an error for invalid attribute value types. 17 func (a AttributeValueType) Validate() error { 18 switch a { 19 case AttributeValueTypeInt: 20 case AttributeValueTypeHex: 21 case AttributeValueTypeFloat: 22 case AttributeValueTypeString: 23 case AttributeValueTypeEnum: 24 default: 25 return fmt.Errorf("invalid attribute value type: %v", a) 26 } 27 return nil 28 }