commons-go/model/meta/MetaProbeStatus.go

48 lines
1.1 KiB
Go
Raw Permalink Normal View History

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 (e MetaProbeStatusEnum) String() string {
return metaProbeStatusEnumID[e]
}
func ToMetaProbeStatusEnum(v *MetaProbeStatus) MetaProbeStatusEnum {
return metaProbeStatusEnumKey[v.Key]
}
func ToMetaProbeStatus(v MetaProbeStatusEnum) *MetaProbeStatus {
return &MetaProbeStatus{
Key: metaProbeStatusEnumID[v],
}
}