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 }