gitlab.com/evatix-go/core@v1.3.55/coreimpl/enumimpl/AllNameValues.go (about) 1 package enumimpl 2 3 import ( 4 "fmt" 5 "reflect" 6 7 "gitlab.com/evatix-go/core/constants" 8 ) 9 10 func AllNameValues(nameStrings []string, anyEnumVal interface{}) []string { 11 reflectValues := reflect.ValueOf(anyEnumVal) 12 length := reflectValues.Len() 13 slice := make([]string, length) 14 15 for i := 0; i < length; i++ { 16 rfVal := reflectValues.Index(i) 17 anyVal := rfVal.Interface() 18 19 slice[i] = fmt.Sprintf( 20 constants.EnumNameValueFormat, 21 nameStrings[i], 22 anyVal) 23 } 24 25 return slice 26 }