model/meta/MetaServiceType.go

72 lines
1.9 KiB
Go
Raw Permalink Normal View History

2018-09-12 03:10:59 +00:00
package meta
import (
"encoding/json"
"git.loafle.net/overflow/model/util"
)
type MetaServiceType 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 MetaServiceTypeEnum int
const (
MetaServiceTypeEnumUNKNOWN MetaServiceTypeEnum = iota + 1
MetaServiceTypeEnumNetwork
2018-09-12 04:26:56 +00:00
MetaServiceTypeEnumDirectory
MetaServiceTypeEnumMonitoring
2018-09-12 03:10:59 +00:00
MetaServiceTypeEnumDatabase
MetaServiceTypeEnumNoSQL
MetaServiceTypeEnumMail
MetaServiceTypeEnumSearch
MetaServiceTypeEnumWeb
MetaServiceTypeEnumWAS
)
var (
metaServiceTypeEnumID = map[MetaServiceTypeEnum]string{
2018-09-12 04:26:56 +00:00
MetaServiceTypeEnumUNKNOWN: "UNKNOWN",
MetaServiceTypeEnumNetwork: "NETWORK",
MetaServiceTypeEnumMonitoring: "MONITORING",
MetaServiceTypeEnumDirectory: "DIRECTORY",
MetaServiceTypeEnumDatabase: "DATABASE",
MetaServiceTypeEnumNoSQL: "NOSQL",
MetaServiceTypeEnumMail: "MAIL",
MetaServiceTypeEnumSearch: "SEARCH",
MetaServiceTypeEnumWeb: "WEB",
MetaServiceTypeEnumWAS: "WAS",
2018-09-12 03:10:59 +00:00
}
metaServiceTypeEnumKey = map[string]MetaServiceTypeEnum{
2018-09-12 04:26:56 +00:00
"UNKNOWN": MetaServiceTypeEnumUNKNOWN,
"NETWORK": MetaServiceTypeEnumNetwork,
"MONITORING": MetaServiceTypeEnumMonitoring,
"DIRECTORY": MetaServiceTypeEnumDirectory,
"DATABASE": MetaServiceTypeEnumDatabase,
"NOSQL": MetaServiceTypeEnumNoSQL,
"MAIL": MetaServiceTypeEnumMail,
"SEARCH": MetaServiceTypeEnumSearch,
"WEB": MetaServiceTypeEnumWeb,
"WAS": MetaServiceTypeEnumWAS,
2018-09-12 03:10:59 +00:00
}
)
func (e MetaServiceTypeEnum) String() string {
return metaServiceTypeEnumID[e]
}
func ToMetaServiceTypeEnum(v *MetaServiceType) MetaServiceTypeEnum {
return metaServiceTypeEnumKey[v.Key]
}
func ToMetaServiceType(v MetaServiceTypeEnum) *MetaServiceType {
return &MetaServiceType{
Key: metaServiceTypeEnumID[v],
}
}