app-cloudep-portal-api-gateway/internal/domain/platform.go

32 lines
491 B
Go
Raw Permalink Normal View History

2024-08-26 06:36:58 +00:00
package domain
type Platform int64
func (p Platform) ToInt64() int64 {
return int64(p)
}
const (
PlatformNone Platform = -1
)
const (
PlatformDigimon Platform = iota + 1
PlatformGoogle
PlatformTwitter
)
var convPlatformCode = map[string]Platform{
"digimon": PlatformDigimon,
"google": PlatformGoogle,
"twitter": PlatformTwitter,
}
func GetPlatformByPlatformCode(code string) Platform {
result, ok := convPlatformCode[code]
if !ok {
return PlatformNone
}
return result
}