Documentation
¶
Index ¶
- Constants
- func CheckChinese(s string) bool
- func CheckDate(s string) bool
- func CheckDatetime(s string) bool
- func CheckEmail(s string) bool
- func CheckEnglish(s string) bool
- func CheckFloat(s string) bool
- func CheckInteger(s string) bool
- func CheckPassword(s string) bool
- func CheckPhone(s string) bool
- func CheckRegexp(target, pattern string) bool
- func CheckTime(s string) bool
Constants ¶
View Source
const ( DirAndFile = "all" OnlyDir = "dir" OnlyFile = "file" Go = ".go" Java = ".java" Sql = ".sql" Txt = ".txt" Json = ".json" Yml = ".yml" Yaml = ".yaml" Toml = ".toml" Properties = ".properties" Jar = ".jar" Mod = ".mod" Class = ".class" Log = ".log" Shell = ".sh" Bat = ".bat" Xml = ".xml" Html = ".html" Doc = ".doc" Docx = ".docx" Xls = ".xls" Xlsx = ".xlsx" Ppt = ".ppt" Pptx = ".pptx" Pdf = ".pdf" Md = ".md" Mp3 = ".mp3" Mp4 = ".mp4" Jpg = ".jpg" Png = ".png" Heic = ".heic" Wav = ".wav" )
View Source
const ( POST = "POST" GET = "GET" PUT = "PUT" DELETE = "DELETE" HttpPrefix = "http://" ContentType = "Content-Type" Authorization = "Authorization" JsonContent = "application/json" FormContent = "application/x-www-form-urlencoded" GBKContent = "application/javascript;charset=GBK" )
View Source
const ( Min = "min" // 最小值 Max = "max" // 最大值 Prefix = "prefix" // 前缀 Suffix = "suffix" // 后缀 Prec = "prec" // 小数位 Format = "format" // 时间格式 Length = "length" // 长度 Lower = "lower" // 小写 Upper = "upper" // 大写 HasNumber = "has_number" // 是否含有数字 HasSymbol = "has_symbol" // 是否含有符号 Old = "old" // 替换旧字符 New = "new" // 替换新字符 Options = "options" // 枚举选项,多个以逗号分割 Table = "table" // 表名,表字段所属表名 Field = "field" // 字段名 )
随机数据生成约束条件关键字
View Source
const ( LetterLower = "abcdefghijklmnopqrstuvwxyz" LetterUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" CharLower = "abcdefghijklmnopqrstuvwxyz1234567890" CharAll = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" NUMBER = "1234567890" SPECIAL = "!@#$%&*+-=?" ProvinceSimple = "" /* 135-byte string literal not displayed */ ProvinceName = "" /* 420-byte string literal not displayed */ HubeiCityName = "武汉,黄石,十堰,宜昌,襄阳,鄂州,荆门,孝感,荆州,黄冈,咸宁,随州,恩施,仙桃,潜江,天门,神农架" HubeiPostcode = "420100,420200,420300,420500,420600,420700,420800,420900,421000,421100,421200,421300,422800,429004,429005,429006,429021" FamilyNameCn = "赵,钱,孙,李,周,吴,黄,高,郑,王,冯,陈,蒋,沈,韩,杨,朱,秦,许,何,吕,张,孔,曹" NumberCn = "一,二,三,四,五,六,七,八,九,十,百,千,万,亿" Animal = "鼠,牛,虎,兔,龙,蛇,马,羊,猴,鸡,狗,猪" PhonePrefix = "358" )
字典配置
View Source
const ( ChineseRegex = `^[\u4e00-\u9fa5]+$` // 中文 EnglishRegex = `^[a-zA-Z]+$` // 英文 IntegerRegex = `^[0-9]+$` // 数字 FloatRegex = `^[0-9]+.[0-9]+$` // 数字 PhoneRegex = `^1[3-9]\d{9}$` // 手机号格式 EmailRegex = `^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$` // 邮箱地址格式 PasswordRegex = `^[a-zA-Z0-9_-]{6,18}$` // 密码格式 DatetimeRegex = `^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$` // 日期时间 DateRegex = `^\d{4}-\d{2}-\d{2}$` // 日期格式 TimeRegex = `^\d{2}:\d{2}:\d{2}$` // 时间格式 )
View Source
const ( String = "string" Varchar = "varchar" Varchar255 = "varchar(255)" Text = "text" Int = "int" Smallint = "smallint" Tinyint = "tinyint" Bigint = "bigint" Int2 = "int2" Int4 = "int4" Int8 = "int8" Int64 = "int64" Float4 = "float4" Numeric = "numeric" // 数字 Numeric6 = "numeric(10,6)" Numeric2 = "numeric(10,2)" Time = "time.Time" Timestamp = "timestamp" Date = "date" Bool = "bool" )
共用数据类型
View Source
const ( JavaString = "String" JavaInteger = "Integer" JavaLong = "Long" JavaDate = "Date" JavaBigDecimal = "BigDecimal" JavaBoolean = "Boolean" )
java类常用类型
View Source
const ( CkString = "String" CkInt8 = "Int8" CkInt16 = "Int16" CkInt32 = "Int32" CkDate = "Date" CkDateTime = "DateTime" CkFloat64 = "Float64" CkBool = "Bool" )
java类常用类型
View Source
const ( Comma = "," Pause = ";" LeftBracket = "(" RightBracket = ")" Underline = "_" Split = "&" Equal = "=" NextLine = "\n" Tab = "\t" ForwardSlash = "/" BackSlash = "\\" )
View Source
const ( TimestampFmt = "20060102150405" TimeFmt = "2006-01-02 15:04:05" DateFmt = "2006-01-02" MonthFmt = "2006-01" )
Variables ¶
This section is empty.
Functions ¶
func CheckChinese ¶
func CheckDatetime ¶
func CheckEmail ¶
func CheckEnglish ¶
func CheckFloat ¶
func CheckInteger ¶
func CheckPassword ¶
func CheckPhone ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.