commons-go/model/meta/MetaMemberStatus.go

54 lines
1.3 KiB
Go
Raw Normal View History

2018-04-26 07:37:59 +00:00
package meta
2018-04-12 09:38:04 +00:00
2018-06-12 09:18:11 +00:00
import (
"encoding/json"
2018-06-12 13:13:22 +00:00
2018-06-12 09:18:11 +00:00
"git.loafle.net/overflow/commons-go/core/util"
)
2018-04-12 09:38:04 +00:00
type MetaMemberStatus struct {
2018-06-12 13:13:22 +00:00
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Key string `json:"key,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
2018-06-12 09:18:11 +00:00
}
type MetaMemberStatusEnum int
const (
2018-06-13 09:53:17 +00:00
MetaMemberStatusEnumNOAUTH MetaMemberStatusEnum = iota + 1
MetaMemberStatusEnumNORMAL
MetaMemberStatusEnumDORMANCY
MetaMemberStatusEnumWITHDRAWAL
2018-06-12 09:18:11 +00:00
)
var (
2018-06-12 13:13:22 +00:00
metaMemberStatusEnumID = map[MetaMemberStatusEnum]string{
MetaMemberStatusEnumNOAUTH: "NOAUTH",
MetaMemberStatusEnumNORMAL: "NORMAL",
MetaMemberStatusEnumDORMANCY: "DORMANCY",
2018-06-12 09:18:11 +00:00
MetaMemberStatusEnumWITHDRAWAL: "WITHDRAWAL",
}
metaMemberStatusEnumKey = map[string]MetaMemberStatusEnum{
2018-06-12 13:13:22 +00:00
"NOAUTH": MetaMemberStatusEnumNOAUTH,
"NORMAL": MetaMemberStatusEnumNORMAL,
"DORMANCY": MetaMemberStatusEnumDORMANCY,
"WITHDRAWAL": MetaMemberStatusEnumWITHDRAWAL,
2018-06-12 09:18:11 +00:00
}
)
2018-06-13 10:02:43 +00:00
func (e MetaMemberStatusEnum) String() string {
return metaMemberStatusEnumID[e]
}
2018-06-12 09:18:11 +00:00
func ToMetaMemberStatusEnum(v *MetaMemberStatus) MetaMemberStatusEnum {
return metaMemberStatusEnumKey[v.Key]
}
func ToMetaMemberStatus(v MetaMemberStatusEnum) *MetaMemberStatus {
return &MetaMemberStatus{
Key: metaMemberStatusEnumID[v],
}
2018-04-12 09:38:04 +00:00
}