model/meta/MetaMemberStatus.go

54 lines
1.3 KiB
Go
Raw Permalink Normal View History

2018-08-12 10:46:46 +00:00
package meta
import (
"encoding/json"
"git.loafle.net/overflow/model/util"
)
type MetaMemberStatus struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Key string `json:"key,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}
type MetaMemberStatusEnum int
const (
MetaMemberStatusEnumNOAUTH MetaMemberStatusEnum = iota + 1
MetaMemberStatusEnumNORMAL
MetaMemberStatusEnumDORMANCY
MetaMemberStatusEnumWITHDRAWAL
)
var (
metaMemberStatusEnumID = map[MetaMemberStatusEnum]string{
MetaMemberStatusEnumNOAUTH: "NOAUTH",
MetaMemberStatusEnumNORMAL: "NORMAL",
MetaMemberStatusEnumDORMANCY: "DORMANCY",
MetaMemberStatusEnumWITHDRAWAL: "WITHDRAWAL",
}
metaMemberStatusEnumKey = map[string]MetaMemberStatusEnum{
"NOAUTH": MetaMemberStatusEnumNOAUTH,
"NORMAL": MetaMemberStatusEnumNORMAL,
"DORMANCY": MetaMemberStatusEnumDORMANCY,
"WITHDRAWAL": MetaMemberStatusEnumWITHDRAWAL,
}
)
func (e MetaMemberStatusEnum) String() string {
return metaMemberStatusEnumID[e]
}
func ToMetaMemberStatusEnum(v *MetaMemberStatus) MetaMemberStatusEnum {
return metaMemberStatusEnumKey[v.Key]
}
func ToMetaMemberStatus(v MetaMemberStatusEnum) *MetaMemberStatus {
return &MetaMemberStatus{
Key: metaMemberStatusEnumID[v],
}
}