在Go语言中并没有提供enum类型的定义,但可以通过const来实现枚举类型
package main
import "fmt"
type EnumType int // 定义枚举类型
const (
_ EnumType = iota // 根据iota特性定义枚举类型常量
LOGIN
REG
)
func (t EnumType) String() string
在Go语言中并没有提供enum类型的定义,但可以通过const来实现枚举类型
package main
import "fmt"
type EnumType int // 定义枚举类型
const (
_ EnumType = iota // 根据iota特性定义枚举类型常量
LOGIN
REG
)
func (t EnumType) String() string