aenum

package
v0.0.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
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)
)
View Source
const (
	ContentType   = "Content-Type"
	ContentLength = "Content-Length"
	Etag          = "Etag"
	LastModified  = "Last-Modified"

	CtJSON = "application/json"

	CtHtmlText = "text/html; charset=utf-8"
)
View Source
const (
	HttpStatusAccountConflict = 490 // 授权登录成功,但是该授权账户绑定过的UID,和当前登录的UID不一致。
	HttpStatusAccountUnlinked = 491 // 已经授权登陆,但是需要绑定手机号/账号
)
View Source
const AaBirthDate = int64(690134400) // 秒   1991-11-15
View Source
const DateMax = "9999-12-31"
View Source
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

View Source
const DatetimeMax = "9999-12-31 23:59:59"
View Source
const DatetimeMin = "0000-00-00 00:00:00"
View Source
const GoDateLayout = "2006-01-02"
View Source
const GoDatetimeLayout = "2006-01-02 15:04:05"
View Source
const OneDay = int64(24 * 3600) // 一天秒数
View Source
const OneMonth = 30 * OneDay // 30 days
View Source
const OneWeek = 7 * OneDay // 1个礼拜秒数
View Source
const OneYear = 365 * OneDay // 365 days

Variables

This section is empty.

Functions

func TelWithCallingCode

func TelWithCallingCode(cc CountryId, tel string) string

转化成拨打模式

func ToCallingCode

func ToCallingCode(cc CountryId) uint16

func ToDatetime

func ToDatetime(d string) string

Types

type AudioType

type AudioType uint16
const (
	UnknownAudioType AudioType = 0
	Mp3              AudioType = 1
	X3pg             AudioType = 2
	X3pg2            AudioType = 3
)

func NewAudioType

func NewAudioType(mime string) (AudioType, bool)

func (AudioType) In

func (t AudioType) In(ts []AudioType) bool

func (AudioType) Is

func (t AudioType) Is(t2 AudioType) bool

func (AudioType) Name

func (t AudioType) Name() string

func (AudioType) Raw

func (t AudioType) Raw() uint16

func (AudioType) String

func (t AudioType) String() string

func (AudioType) Valid

func (t AudioType) Valid() bool

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 Bank

type Bank uint
const (
	BankICBC Bank = 1 // 中国工商银行
)

func (Bank) String

func (bank Bank) String() string

func (Bank) Stringify

func (bank Bank) Stringify() string

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

func NewCountryId(id uint16) (CountryId, bool)

func (CountryId) In

func (c CountryId) In(s []CountryId) bool

func (CountryId) Name

func (c CountryId) Name() string

func (CountryId) String

func (c CountryId) String() string

func (CountryId) Valid

func (c CountryId) Valid() bool

type Currency

type Currency uint16

func NewCurrency

func NewCurrency(x uint16) (Currency, bool)

func (Currency) Name

func (currency Currency) Name() string

func (Currency) String

func (currency Currency) String() string

func (Currency) Valid

func (c Currency) Valid() bool

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

func NewEduLevel(x uint8) (EduLevel, bool)

func (EduLevel) Valid

func (l EduLevel) Valid() bool

type EduRating

type EduRating uint8 // 学院评级
const (
	NormalUniversity EduRating = 0 // 一般院校
	GoodUniversity   EduRating = 1 // 好大学,双一流大学
	TalentUniversity EduRating = 2 // 人才院校,一般国内985(不含TOP100- 清华、港大、北大、港科大、复旦、港中大、上海交大、港城大、浙大、台大、港理工、中科大)
	EliteUniversity  EduRating = 3 // 精英院校,世界TOP100
)

func NewEduRating

func NewEduRating(x uint8) (EduRating, bool)

func (EduRating) Valid

func (l EduRating) Valid() bool

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
const (
	UnknownImageType ImageType = 0
	Jpeg             ImageType = 1
	Png              ImageType = 2
	Gif              ImageType = 3
	Webp             ImageType = 4
)

func NewImageType

func NewImageType(mime string) (ImageType, bool)

func (ImageType) ContentType added in v0.0.9

func (t ImageType) ContentType() string

func (ImageType) In

func (t ImageType) In(ts []ImageType) bool

func (ImageType) Is

func (t ImageType) Is(t2 ImageType) bool

func (ImageType) Name

func (t ImageType) Name() string

func (ImageType) Raw

func (t ImageType) Raw() uint16

func (ImageType) String

func (t ImageType) String() string

func (ImageType) Valid

func (t ImageType) Valid() bool

type Language

type Language uint8
const (
	UnknownLanguage Language = 0
	EnUS            Language = 1
	ZhCN            Language = 86 // simpified chinese

)

type Net

type Net uint8
const (
	UnknownNet Net = 0
	NetWIFI    Net = 1
	Tel2G      Net = 2
	Tel3G      Net = 3
	Tel4G      Net = 4
	Tel5G      Net = 5
	Tel6G      Net = 6
)

func ToNet

func ToNet(network Network) Net

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
)

type Qos

type Qos uint8
const (
	Qos0 Qos = 0
	Qos1 Qos = 1
	Qos2 Qos = 2
)

func (Qos) String

func (qos Qos) String() string

func (Qos) Stringify

func (qos Qos) Stringify() string

type Sex

type Sex uint8
const (
	UnknownSex Sex = 0
	Male       Sex = 1
	Female     Sex = 2
	OtherSex   Sex = 255
)

func NewSex

func NewSex(s interface{}) (Sex, bool)

func (Sex) Is

func (x Sex) Is(x2 Sex) bool

func (Sex) Name

func (x Sex) Name() string

func (Sex) Raw

func (x Sex) Raw() uint8

func (Sex) String

func (x Sex) String() string

func (Sex) Valid

func (x Sex) Valid() bool

type Status

type Status int8
const (
	Deleted       Status = -128 //已删除
	PendingReview Status = -1   // 未审核,不展示
	Created       Status = 0    // 显示
	Verified      Status = 1    // 审核通过,展示
	Topping       Status = 100  // 未完成,置顶展示
	Closed        Status = 126  // 已关闭,展示
	Finished      Status = 127  // 已完成,展示
)

type VideoType

type VideoType uint16
const (
	UnknownVideoType VideoType = 0
	Avi              VideoType = 1
	Mov              VideoType = 2 // Apple QuickTime
	Mpeg             VideoType = 3
	Mp4              VideoType = 4 // MPEG-4
	X3gp             VideoType = 5
	X3gp2            VideoType = 6
)

func NewVideoType

func NewVideoType(mime string) (VideoType, bool)

func (VideoType) In

func (t VideoType) In(ts []VideoType) bool

func (VideoType) Is

func (t VideoType) Is(t2 VideoType) bool

func (VideoType) Name

func (t VideoType) Name() string

func (VideoType) Raw

func (t VideoType) Raw() uint16

func (VideoType) String

func (t VideoType) String() string

func (VideoType) Valid

func (t VideoType) Valid() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL