28cd64a0c2
This reverts commit 06a799f5a6
54 lines
1.3 KiB
Go
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],
|
|
}
|
|
}
|