mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-13 00:04:29 +00:00
go: give enums their own scalar types
This commit is contained in:
@@ -2,14 +2,15 @@
|
||||
|
||||
package Example
|
||||
|
||||
type Any = byte
|
||||
const (
|
||||
AnyNONE = 0
|
||||
AnyMonster = 1
|
||||
AnyTestSimpleTableWithEnum = 2
|
||||
AnyMyGame_Example2_Monster = 3
|
||||
AnyNONE Any = 0
|
||||
AnyMonster Any = 1
|
||||
AnyTestSimpleTableWithEnum Any = 2
|
||||
AnyMyGame_Example2_Monster Any = 3
|
||||
)
|
||||
|
||||
var EnumNamesAny = map[int]string{
|
||||
var EnumNamesAny = map[Any]string{
|
||||
AnyNONE:"NONE",
|
||||
AnyMonster:"Monster",
|
||||
AnyTestSimpleTableWithEnum:"TestSimpleTableWithEnum",
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
package Example
|
||||
|
||||
type Color = int8
|
||||
const (
|
||||
ColorRed = 1
|
||||
ColorGreen = 2
|
||||
ColorBlue = 8
|
||||
ColorRed Color = 1
|
||||
ColorGreen Color = 2
|
||||
ColorBlue Color = 8
|
||||
)
|
||||
|
||||
var EnumNamesColor = map[int]string{
|
||||
var EnumNamesColor = map[Color]string{
|
||||
ColorRed:"Red",
|
||||
ColorGreen:"Green",
|
||||
ColorBlue:"Blue",
|
||||
|
||||
Reference in New Issue
Block a user