acces to string on enum

This commit is contained in:
mr 2024-07-26 14:15:55 +02:00
parent 8c97fca96c
commit eb1417853a
2 changed files with 7 additions and 3 deletions

View File

@ -21,6 +21,10 @@ const (
WORKSPACE = utils.WORKSPACE WORKSPACE = utils.WORKSPACE
) )
func (d LibDataEnum) String() string {
return utils.Str[d]
}
func (d LibDataEnum) EnumIndex() int { func (d LibDataEnum) EnumIndex() int {
return int(d) return int(d)
} }

View File

@ -14,7 +14,7 @@ const (
WORKSPACE WORKSPACE
) )
var str = [...]string{ var Str = [...]string{
"invalid", "invalid",
"data_resource", "data_resource",
"processing_resource", "processing_resource",
@ -27,11 +27,11 @@ var str = [...]string{
} }
func FromInt(i int) string { func FromInt(i int) string {
return str[i] return Str[i]
} }
func (d DataType) String() string { func (d DataType) String() string {
return str[d] return Str[d]
} }
// EnumIndex - Creating common behavior-give the type a EnumIndex functio // EnumIndex - Creating common behavior-give the type a EnumIndex functio