commons-go/model/meta/MetaProbeStatus.go

44 lines
1020 B
Go
Raw Normal View History

2018-04-26 07:37:59 +00:00
package meta
2018-04-12 09:38:04 +00:00
2018-06-12 09:18:11 +00:00
import (
"encoding/json"
2018-06-12 13:13:22 +00:00
2018-06-12 09:18:11 +00:00
"git.loafle.net/overflow/commons-go/core/util"
)
2018-04-12 09:38:04 +00:00
type MetaProbeStatus struct {
2018-06-12 13:13:22 +00:00
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Key string `json:"key,omitempty"`
2018-06-12 09:18:11 +00:00
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}
type MetaProbeStatusEnum int
const (
MetaProbeStatusEnumINITIAL MetaProbeStatusEnum = 1
MetaProbeStatusEnumNORMAL MetaProbeStatusEnum = 2
)
var (
2018-06-12 13:13:22 +00:00
metaProbeStatusEnumID = map[MetaProbeStatusEnum]string{
2018-06-12 09:18:11 +00:00
MetaProbeStatusEnumINITIAL: "INITIAL",
MetaProbeStatusEnumNORMAL: "NORMAL",
}
metaProbeStatusEnumKey = map[string]MetaProbeStatusEnum{
2018-06-12 13:13:22 +00:00
"INITIAL": MetaProbeStatusEnumINITIAL,
"NORMAL": MetaProbeStatusEnumNORMAL,
2018-06-12 09:18:11 +00:00
}
)
func ToMetaProbeStatusEnum(v *MetaProbeStatus) MetaProbeStatusEnum {
return metaProbeStatusEnumKey[v.Key]
2018-04-12 09:38:04 +00:00
}
2018-06-12 09:18:11 +00:00
func ToMetaProbeStatus(v MetaProbeStatusEnum) *MetaProbeStatus {
return &MetaProbeStatus{
Key: metaProbeStatusEnumID[v],
}
2018-06-12 13:13:22 +00:00
}