commons-go/model/meta/MetaProbeStatus.go
crusader 6d6ac17b0a ing
2018-06-13 18:53:17 +09:00

44 lines
1002 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 = iota + 1
MetaProbeStatusEnumNORMAL
)
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],
}
}