How do I access the map value for the following code? The code snippet is auto generated, so I can't modify it. I have tried OpType_name[OpType_UNKNOWN]
but I am getting error from the golang compiler.
type OpType int32
const (
OpType_UNKNOWN OpType = 0
OpType_CREATE OpType = 1
OpType_DELETE OpType = 3
)
var OpType_name = map[int32]string{
0: "UNKNOWN",
1: "CREATE",
2: "DELETE",
}
var OpType_value = map[string]int32{
"UNKNOWN": 0,
"CREATE": 1,
"DELETE": 2,
}
Error:
cannot use int(api.OpType_UNKNOWN) (type int) as type int32 in map index