enum.go 307 B

1234567891011121314151617181920212223
  1. package enum
  2. import "strings"
  3. type Enum struct {
  4. code int64
  5. desc []string
  6. }
  7. func NewEnum(code int64, desc ...string) *Enum {
  8. return &Enum{
  9. code: code,
  10. desc: desc,
  11. }
  12. }
  13. func (e *Enum) GetCode() int64 {
  14. return e.code
  15. }
  16. func (e *Enum) GetDescription() string {
  17. return strings.Join(e.desc, ",")
  18. }