Documentation ¶
Index ¶
- Constants
- func TelWithCallingCode(cc CountryId, tel string) string
- func ToCallingCode(cc CountryId) uint16
- func ToDatetime(d string) string
- type AudioType
- type Authorization
- type Bank
- type CountryId
- type Currency
- type DataParsing
- type Demo
- type EduConclusion
- type EduLevel
- type EduRating
- type Ethnicity
- type ImageType
- type Language
- type Net
- type Network
- type ProtoType
- type Qos
- type Sex
- type Status
- type VideoType
Constants ¶
const ( UnknownCurrency = Currency(0) USD = Currency(America) CNY = Currency(China) HKD = Currency(HongKong) MOP = Currency(Macau) JPY = Currency(Japan) KHR = Currency(Cambodia) SGD = Currency(Singapore) )
const ( ContentType = "Content-Type" ContentLength = "Content-Length" Etag = "Etag" LastModified = "Last-Modified" CtJSON = "application/json" CtHtmlText = "text/html; charset=utf-8" )
const ( HttpStatusAccountConflict = 490 // 授权登录成功,但是该授权账户绑定过的UID,和当前登录的UID不一致。 HttpStatusAccountUnlinked = 491 // 已经授权登陆,但是需要绑定手机号/账号 )
const AaBirthDate = int64(690134400) // 秒 1991-11-15
const DateMax = "9999-12-31"
const DateMin = "0000-00-00"
https://dev.mysql.com/doc/refman/8.0/en/datetime.html DATETIME values is '1000-01-01 00:00:00.000000' to '9999-12-31 23:59:59.999999', TIMESTAMP values is '1970-01-01 00:00:01.000000' to '2038-01-19 03:14:07.999999' 两个时间最小、最大均不同,所以一定要开启 sql-mode NO_ZERO_DATE,保持最小为 0000-00-00 00:00:00
const DatetimeMax = "9999-12-31 23:59:59"
const DatetimeMin = "0000-00-00 00:00:00"
const GoDateLayout = "2006-01-02"
const GoDatetimeLayout = "2006-01-02 15:04:05"
const OneDay = int64(24 * 3600) // 一天秒数
const OneMonth = 30 * OneDay // 30 days
const OneWeek = 7 * OneDay // 1个礼拜秒数
const OneYear = 365 * OneDay // 365 days
Variables ¶
This section is empty.
Functions ¶
func ToCallingCode ¶
func ToDatetime ¶
Types ¶
type Authorization ¶
type Authorization string
const ( // 适合server 2 server 简易接口验证 字段可以自定义(如 key, secret 自定义命名即可) ApiKey Authorization = "API Key" // Bearer Token( JWT 令牌) //定义:为了验证使用者的身份,需要客户端向服务器端提供一个可靠的验证信息,称为Token,这个token通常由Json数据格式组成,通过hash散列算法生成一个字符串,所以称为Json Web Token BearerToken Authorization = "Bearer Token" BasicAuth Authorization = "Basic Auth" DigestAuth Authorization = "Digest Auth" // 需要用户手动点授权,之后才获取用户信息 OAuth2 Authorization = "OAuth 2.0" HawkAuthentication Authorization = "Hawk Authentication" AwsSignature Authorization = "Aws Signature" )
type CountryId ¶
type CountryId uint16
const ( Canada CountryId = 50001 America CountryId = 1 Kazakhstan CountryId = 50007 Russia CountryId = 7 Egypt CountryId = 20 SouthAfrica CountryId = 27 Greece CountryId = 30 Netherlands CountryId = 31 Belgium CountryId = 32 France CountryId = 33 Spain CountryId = 34 Hungary CountryId = 36 Italy CountryId = 39 Romania CountryId = 40 Switzerland CountryId = 41 Austria CountryId = 43 UnitedKingdom CountryId = 44 Denmark CountryId = 45 Sweden CountryId = 46 Norway CountryId = 47 SvalbardAndJanMayen CountryId = 50047 Poland CountryId = 48 Germany CountryId = 49 Peru CountryId = 51 Mexico CountryId = 52 Cuba CountryId = 53 Argentina CountryId = 54 Brazil CountryId = 55 Chile CountryId = 56 Colombia CountryId = 57 Venezuela CountryId = 58 Malaysia CountryId = 60 Australia CountryId = 61 ChristmasIsland CountryId = 50061 CocosIslands CountryId = 61 Indonesia CountryId = 62 Philippines CountryId = 63 NewZealand CountryId = 64 Pitcairn CountryId = 50064 Singapore CountryId = 65 Thailand CountryId = 66 Japan CountryId = 81 SouthKorea CountryId = 82 Vietnam CountryId = 84 China CountryId = 86 Turkey CountryId = 90 India CountryId = 91 Pakistan CountryId = 92 Afghanistan CountryId = 93 SriLanka CountryId = 94 Myanmar CountryId = 95 Iran CountryId = 98 SouthSudan CountryId = 211 Morocco CountryId = 212 WesternSahara CountryId = 50212 Algeria CountryId = 213 Tunisia CountryId = 216 Libya CountryId = 218 Gambia CountryId = 220 Senegal CountryId = 221 Mauritania CountryId = 222 Mali CountryId = 223 Guinea CountryId = 224 IvoryCoast CountryId = 225 BurkinaFaso CountryId = 226 Niger CountryId = 227 Togo CountryId = 228 Benin CountryId = 229 Mauritius CountryId = 230 Liberia CountryId = 231 SierraLeone CountryId = 232 Ghana CountryId = 233 Nigeria CountryId = 234 Chad CountryId = 235 CentralAfricanRepublic CountryId = 236 Cameroon CountryId = 237 CapeVerde CountryId = 238 SaoTomeAndPrincipe CountryId = 239 EquatorialGuinea CountryId = 240 Gabon CountryId = 241 RepublicOfTheCongo CountryId = 242 DemocraticRepublicOfTheCongo CountryId = 243 Angola CountryId = 244 GuineaBissau CountryId = 245 BritishIndianOceanTerritory CountryId = 246 Seychelles CountryId = 248 Sudan CountryId = 249 Rwanda CountryId = 250 Ethiopia CountryId = 251 Somalia CountryId = 252 Djibouti CountryId = 253 Kenya CountryId = 254 Tanzania CountryId = 255 Uganda CountryId = 256 Burundi CountryId = 257 Mozambique CountryId = 258 Zambia CountryId = 260 Madagascar CountryId = 261 Mayotte CountryId = 262 Reunion CountryId = 262 Zimbabwe CountryId = 263 Namibia CountryId = 264 Malawi CountryId = 265 Lesotho CountryId = 266 Botswana CountryId = 267 Swaziland CountryId = 268 Comoros CountryId = 269 SaintHelena CountryId = 290 Eritrea CountryId = 291 Aruba CountryId = 297 FaroeIslands CountryId = 298 Greenland CountryId = 299 Gibraltar CountryId = 350 Portugal CountryId = 351 Luxembourg CountryId = 352 Ireland CountryId = 353 Iceland CountryId = 354 Albania CountryId = 355 Malta CountryId = 356 Cyprus CountryId = 357 Finland CountryId = 358 Bulgaria CountryId = 359 Lithuania CountryId = 370 Latvia CountryId = 371 Estonia CountryId = 372 Moldova CountryId = 373 Armenia CountryId = 374 Belarus CountryId = 375 Andorra CountryId = 376 Monaco CountryId = 377 SanMarino CountryId = 378 Vatican CountryId = 379 Ukraine CountryId = 380 Serbia CountryId = 381 Montenegro CountryId = 382 Kosovo CountryId = 383 Croatia CountryId = 385 Slovenia CountryId = 386 BosniaAndHerzegovina CountryId = 387 Macedonia CountryId = 389 CzechRepublic CountryId = 420 Slovakia CountryId = 421 Liechtenstein CountryId = 423 FalklandIslands CountryId = 500 Belize CountryId = 501 Guatemala CountryId = 502 ElSalvador CountryId = 503 Honduras CountryId = 504 Nicaragua CountryId = 505 CostaRica CountryId = 506 Panama CountryId = 507 SaintPierreAndMiquelon CountryId = 508 Haiti CountryId = 509 SaintBarthelemy CountryId = 590 SaintMartin CountryId = 590 Bolivia CountryId = 591 Guyana CountryId = 592 Ecuador CountryId = 593 Paraguay CountryId = 595 Suriname CountryId = 597 Uruguay CountryId = 598 Curacao CountryId = 599 NetherlandsAntilles CountryId = 50599 EastTimor CountryId = 670 Antarctica CountryId = 672 Brunei CountryId = 673 Nauru CountryId = 674 PapuaNewGuinea CountryId = 675 Tonga CountryId = 676 SolomonIslands CountryId = 677 Vanuatu CountryId = 678 Fiji CountryId = 679 Palau CountryId = 680 WallisAndFutuna CountryId = 681 CookIslands CountryId = 682 Niue CountryId = 683 Samoa CountryId = 685 Kiribati CountryId = 686 NewCaledonia CountryId = 687 Tuvalu CountryId = 688 FrenchPolynesia CountryId = 689 Tokelau CountryId = 690 Micronesia CountryId = 691 MarshallIslands CountryId = 692 NorthKorea CountryId = 850 HongKong CountryId = 852 Macau CountryId = 853 Cambodia CountryId = 855 Laos CountryId = 856 Bangladesh CountryId = 880 Taiwan CountryId = 886 Maldives CountryId = 960 Lebanon CountryId = 961 Jordan CountryId = 962 Syria CountryId = 963 Iraq CountryId = 964 Kuwait CountryId = 965 SaudiArabia CountryId = 966 Yemen CountryId = 967 Oman CountryId = 968 Palestine CountryId = 970 UnitedArabEmirates CountryId = 971 Israel CountryId = 972 Bahrain CountryId = 973 Qatar CountryId = 974 Bhutan CountryId = 975 Mongolia CountryId = 976 Nepal CountryId = 977 Tajikistan CountryId = 992 Turkmenistan CountryId = 993 Azerbaijan CountryId = 994 Georgia CountryId = 995 Kyrgyzstan CountryId = 996 Uzbekistan CountryId = 998 )
func NewCountryId ¶
type DataParsing ¶
type DataParsing int8 // 解析远程数据,储存远程数据记录时用到
const ( DataParsingCheckFailed DataParsing = -2 // 数据签名核对错误、字段核对错误 DataParsingFailed DataParsing = -1 // 数据解析失败 DataParsingBizFailed DataParsing = 0 // 数据解析成功了,但是业务结果返回失败 DataParsingBizOK DataParsing = 1 // 数据解析成功了,并且业务结果返回成功 )
type Demo ¶
type Demo interface { Valid() bool // 是否在正确范围内 Raw() interface{} // 原始值,如 uint16、byte、string等 String() string // 类型转换为string Name() string // 显示给客户端,同时为了避免客户端侦测太多服务端信息,特别是作为加密因子 Is(demo Demo) bool // 判断是否相等 In(series []interface{}) bool // 是否在某个系列里面 }
func NewDemo() (Demo, bool){}
type EduConclusion ¶
type EduConclusion uint8 // 毕结业结论
const (
GraduationConclusion EduConclusion = 1 // 毕业
)
func NewEduConclusion ¶
func NewEduConclusion(x uint8) (EduConclusion, bool)
func (EduConclusion) Valid ¶
func (l EduConclusion) Valid() bool
type EduLevel ¶
type EduLevel uint8 // 学历
const ( NoEduLevel EduLevel = 0 BelowHighSchool EduLevel = 1 HighSchoolDiploma EduLevel = 2 // 高中学历 ColleageStudent EduLevel = 10 // 全日制专科 在读学生 NonFullTimeColleage EduLevel = 11 // 非全日制专科 FullTimeColleage EduLevel = 12 // 全日制专科 BachelorStudent EduLevel = 20 // 在读全日制本科(非985院校) NonFullTimeBachelor EduLevel = 21 // 非全日制本科(获得学士学位了) undergraduate degree 只有毕业证,没有学位证 FullTimeBachelor EduLevel = 22 // 全日制本科 TalentBachelor EduLevel = 23 // 高等人才学士,全日制985院校(不含TOP100- 清华、港大、北大、港科大、复旦、港中大、上海交大、港城大、浙大、台大、港理工、中科大) EliteBachelor EduLevel = 24 // 精英阶层,世界TOP100院校 NonFullTimePostgraduate EduLevel = 30 // 非全日制研究生 FullTimePostgraduate EduLevel = 31 // 研究生 TalentPostgraduate EduLevel = 32 // 人才硕士 本科是全日制985院校,研究生也是 ElitePostgraduate EduLevel = 33 // 精英硕士 本科是TOP100院校,硕士是海外TOP100院校 NonFullTimeDoctorate EduLevel = 40 // 非全日制博士学位 FullTimeDoctorate EduLevel = 41 // 博士 TalentDoctorate EduLevel = 42 // 人才博士,本科是全日制985院校,研究生也是 EliteDoctorate EduLevel = 43 // 精英博士,本科是TOP100院校,硕士是世界TOP100院校 )
func NewEduLevel ¶
type Ethnicity ¶
type Ethnicity uint8
中国民族
const ( UnknownNationality Ethnicity = 0 HanZu Ethnicity = 1 // 汉族 ManZu Ethnicity = 2 // 满族 MengguZu Ethnicity = 3 // 蒙古族 HuiZu Ethnicity = 4 // 回族 ZangZu Ethnicity = 5 // 藏族 WeiwuerZu Ethnicity = 6 // 维吾尔族 MiaoZu Ethnicity = 7 // 苗族 YiZu Ethnicity = 8 // 彝族 ZhuangZu Ethnicity = 9 // 壮族 BuyiZu Ethnicity = 10 // 布依族 )
type ImageType ¶
type ImageType uint16
func NewImageType ¶
func (ImageType) ContentType ¶ added in v0.0.9
type Network ¶
type Network uint16
const ( UnknownNetwork Network = 0 WIFI Network = 1 // 2G TelOther2G Network = 200 TelEDGE Network = 201 TelGPRS Network = 202 TelCDMA1x Network = 203 Tel1xRTT Network = 204 TelIDEN Network = 205 TelOther3G Network = 300 TelHSDPA Network = 301 TelHSUPA Network = 302 TelWCDMA Network = 303 TelCdmaEvdo0 Network = 304 TelCdmaEvdoA Network = 305 TelCdmaEvdoB Network = 306 TelEHRPD Network = 307 TelHSPA Network = 308 TelHSPAP Network = 309 TelUMTS Network = 310 TelOther4G Network = 400 TelLTE Network = 401 )
GPRS : 2G(2.5) General Packet Radia Name 114kbps EDGE : 2G(2.75G) Enhanced Data Rate for GSM Evolution 384kbps UMTS : 3G WCDMA 联通3G Universal Mobile Telecommunication System 完整的3G移动通信技术标准 CDMA : 2G 电信 Code Division Multiple Access 码分多址 EVDO_0 : 3G (EVDO 全程 CDMA2000 1xEV-DO) Evolution - Data Only (Data Optimized) 153.6kps - 2.4mbps 属于3G EVDO_A : 3G 1.8mbps - 3.1mbps 属于3G过渡,3.5G 1xRTT : 2G CDMA2000 1xRTT (RTT - 无线电传输技术) 144kbps 2G的过渡, HSDPA : 3.5G 高速下行分组接入 3.5G WCDMA High Speed Downlink Packet Access 14.4mbps HSUPA : 3.5G High Speed Uplink Packet Access 高速上行链路分组接入 1.4 - 5.8 mbps HSPA : 3G (分HSDPA,HSUPA) High Speed Packet Access IDEN : 2G Integrated Dispatch Enhanced Networks 集成数字增强型网络 (属于2G,来自维基百科) EVDO_B : 3G EV-DO Rev.B 14.7Mbps 下行 3.5G LTE : 4G Long Term Evolution FDD-LTE 和 TDD-LTE , 3G过渡,升级版 LTE Advanced 才是4G EHRPD : 3G CDMA2000向LTE 4G的中间产物 Evolved High Rate Packet Data HRPD的升级 HSPAP : 3G HSPAP 比 HSDPA 快些
type ProtoType ¶
type ProtoType uint8
配置文件协议类型
const ( StringVtype ProtoType = 0 // 为了兼容日后的 protobuf Int8Vtype ProtoType = 1 Uint8Vtype ProtoType = 2 Int16Vtype ProtoType = 3 Uint16Vtype ProtoType = 4 Int32Vtype ProtoType = 5 Uint32Vtype ProtoType = 6 Int64Vtype ProtoType = 7 Uint64Vtype ProtoType = 8 Float32Vtype ProtoType = 9 Float64Vtype ProtoType = 10 StringsVtype ProtoType = 100 // 字符串数组 Int8sVtype ProtoType = 101 Uint8sVtype ProtoType = 102 Int16sVtype ProtoType = 103 Uint16sVtype ProtoType = 104 Int32sVtype ProtoType = 105 Uint32sVtype ProtoType = 106 Int64sVtype ProtoType = 107 Uint64sVtype ProtoType = 108 Float32sVtype ProtoType = 109 Float64sVtype ProtoType = 110 )