Documentation ¶
Index ¶
- Constants
- func CheckTimeRangeLimitDayNumValid(startTime, endTime, limitDay int64) bool
- func CheckTimeRangeTimeNumIsValid(secondsNum int64, startTime, endTime int64) bool
- func FormatFloatWithoutZero(num float64, decimal int) string
- func FormatNeedTimeIntoSecondNumber(hourStr string) int64
- func FormatNeedTimeIntoString(secondNum int64) string
- func Round(f float64, n int) float64
- func TransformTimeStampToDate(timeStamp int64) string
- func VerifyChinaPhoneFormat(phone string) bool
- func VerifyChinaPhoneWithoutAreaFormat(phone string) bool
- func VerifyDepartmentName(name string) bool
- func VerifyEmailFormat(emails ...string) bool
- func VerifyFloat1(input string) bool
- func VerifyFolderNameFormat(input string) bool
- func VerifyForeignPhoneNumberFormat(phone string) bool
- func VerifyIssueCommenFormat(input string) bool
- func VerifyIssueNameFormat(input string) bool
- func VerifyIssueRemarkFormat(input string) bool
- func VerifyOrgAdressFormat(input string) bool
- func VerifyOrgCodeFormat(input string) bool
- func VerifyOrgNameFormat(input string) bool
- func VerifyPhoneRegionFormat(regionCode string) bool
- func VerifyProjectNameFormat(input string) bool
- func VerifyProjectNoticeFormat(input string) bool
- func VerifyProjectObjectTypeNameFormat(input string) bool
- func VerifyProjectPreviousCodeFormat(input string) bool
- func VerifyProjectRemarkFormat(input string) bool
- func VerifyPwdFormat(password string) bool
- func VerifyResourceNameFormat(input string) bool
- func VerifyRoleNameFormat(input string) bool
- func VerifySqlFieldFormat(input string) bool
- func VerifyTableNameFormat(name string) bool
- func VerifyUserNameFormat(input string) bool
- func VerifyWebLinkFormat(str string) bool
Constants ¶
View Source
const ( EmailPattern = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*` //用户邮箱 PasswordPattern = `^[a-zA-Z]\w{5,17}$` //用户密码 UserNamePattern = "^[ 0-9A-Za-z-_]{1,40}$" //用户名 OrgNamePattern = "^[\u4e00-\u9fa5|0-9|a-zA-Z]{1,20}$" //组织名 OrgCodePattern = "^[0-9|a-zA-Z]{1,20}$" //网址后缀编号 OrgAdressPattern = `^.{0,100}$` //组织地址 ProjectNamePattern = `^.{1,30}$` //项目名 ProjectPreviousCodePattern = `^[a-zA-Z|0-9]{1,50}$` //项目前缀编号 ProjectRemarkPattern = `^[\s\S]{0,500}$` //项目描述(简介) //ProjectNoticePattern = `^.{0,2000}$` //项目公告 IssueNamePattern = `^(.|\n){0,500}$` //任务名 允许换行符 //IssueRemarkPattern = `^.{0,10000}$` //任务描述(详情) IssueCommenPattern = `^.{0,10000}$` //任务评论 ProjectObjectTypeNamePattern = `^.{1,30}$` //标题栏名 ProjectTableNamePattern = `^.{1,200}$` // 项目表名 //ResourceNamePattern = `^[^\\\\/:*?\"<>|]{1,300}(\.[a-zA-Z0-9]+)?$` //资源名 ResourceNamePattern = `^.{1,300}$` //资源名 FolderNamePattern = `^[^\\\\/:*?\"<>|]{1,30}$` //文件夹名 RoleNamePattern = "^[a-zA-Z|0-9]{1,20}$" //角色名 NumFloat1 = `^([1-9]\d{0,9}|0)(\.\d)?$` //小数点后一位 SqlFieldPattern = `(^_([a-zA-Z0-9]_?)*$)|(^[a-zA-Z](_?[a-zA-Z0-9])*_?$)` //数字、字母、下划线 ChinaPhoneWithAreaFlagPattern = `\+86\ 1[0-9]{10}` //带区号的中国手机号。如:`+86 15010111001` ChinaPhoneWithoutAreaPattern = `1[0-9]{10}` //不带区号的中国手机号。如:`15010111001` ForeignPhoneWithoutAreaPattern = `[0-9]{3,15}` //不带区号的国际手机号。一定是数值,并且一般不超过 15 位 PhoneRegionCodePattern = `\+\d{1,4}` // 国际的手机号码归属地 code WebLinkPattern = `^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$` // web 链接 IssueCommentMemberPattern = "\\#\\[([\u4E00-\u9FA5A-Za-z0-9_]{0,})\\:\\d+\\]\\&\\$" // @成员 评论内容提取成员名字,如:@#[小牟:29520]&$ )
View Source
const ( ChinesePattern = "[\u4e00-\u9fa5]+?" AllBlankPattern = "^ +$" )
Variables ¶
This section is empty.
Functions ¶
func CheckTimeRangeLimitDayNumValid ¶
检查起止日期内,天数是否超过限制
func CheckTimeRangeTimeNumIsValid ¶
检查时间段间的时间,是否合法。不能超过。
func FormatFloatWithoutZero ¶
保留n位小数,并去除小数点后无效的 0。 主要逻辑就是先乘,trunc之后再除回去,就达到了保留N位小数的效果 来自于 https://www.jianshu.com/p/ddec820bc4a4
func FormatNeedTimeIntoSecondNumber ¶
前端输入的小时数转换为秒数
func FormatNeedTimeIntoString ¶
数据库中的数值转为浮点数的小时数,再转为字符串,传给前端。 当浮点数为 `0.0` 时,强制为 `0`
func VerifyChinaPhoneFormat ¶
VerifyChinaPhoneFormat 校验是否是合法的中文手机号码
func VerifyChinaPhoneWithoutAreaFormat ¶
VerifyChinaPhoneWithoutAreaFormat 校验是否是合法的中文手机号码,不带国家代码
func VerifyDepartmentName ¶
func VerifyEmailFormat ¶
func VerifyPhoneRegionFormat ¶
VerifyPhoneRegionFormat 验证手机归属地 code 格式
func VerifyProjectObjectTypeNameFormat ¶
任务栏名字
func VerifyProjectPreviousCodeFormat ¶
项目前缀编号
func VerifyPwdFormat ¶
func VerifyWebLinkFormat ¶
VerifyWebLinkFormat 校验是否是 web 链接
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.