commons-go/model/meta/MetaProbeStatus.go
crusader ab936be303 ing
2018-06-12 22:13:22 +09:00

44 lines
1020 B
Go

package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
type MetaProbeStatus 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 MetaProbeStatusEnum int
const (
MetaProbeStatusEnumINITIAL MetaProbeStatusEnum = 1
MetaProbeStatusEnumNORMAL MetaProbeStatusEnum = 2
)
var (
metaProbeStatusEnumID = map[MetaProbeStatusEnum]string{
MetaProbeStatusEnumINITIAL: "INITIAL",
MetaProbeStatusEnumNORMAL: "NORMAL",
}
metaProbeStatusEnumKey = map[string]MetaProbeStatusEnum{
"INITIAL": MetaProbeStatusEnumINITIAL,
"NORMAL": MetaProbeStatusEnumNORMAL,
}
)
func ToMetaProbeStatusEnum(v *MetaProbeStatus) MetaProbeStatusEnum {
return metaProbeStatusEnumKey[v.Key]
}
func ToMetaProbeStatus(v MetaProbeStatusEnum) *MetaProbeStatus {
return &MetaProbeStatus{
Key: metaProbeStatusEnumID[v],
}
}