commons-go/model/meta/MetaMemberStatus.go
2018-08-13 01:42:47 +00:00

54 lines
1.3 KiB
Go

package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/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],
}
}