commons-go/model/meta/MetaProbeStatus.go

48 lines
1.1 KiB
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 (
2018-06-13 09:53:17 +00:00
MetaProbeStatusEnumINITIAL MetaProbeStatusEnum = iota + 1
MetaProbeStatusEnumNORMAL
2018-06-12 09:18:11 +00:00
)
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
}
)
2018-06-13 10:02:43 +00:00
func (e MetaProbeStatusEnum) String() string {
return metaProbeStatusEnumID[e]
}
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
}