Documentation
¶
Overview ¶
*
- @api post utils. *
- User: yunshengzhu
- Date: 2019-04-25
- Time: 17:22
*
- @api post utils. *
- User: yunshengzhu
- Date: 2019-03-15
- Time: 10:34
*
- @api post utils. *
- User: yunshengzhu
- Date: 2021/12/25
- Time: 下午6:49
*
- @api post utils. *
- User: yunshengzhu
- Date: 2022/1/5
- Time: 下午1:07
Index ¶
- Constants
- Variables
- func Age(id string) int
- func Bytes2str(b []byte) string
- func CheckBirthday(id string) int64
- func CreateOrderNumber(num int) string
- func CreatePwd(n int) string
- func DataUnix(str, format string) int64
- func DateString(s int64, format string) string
- func DecodeData(data, key string) (string, error)
- func EncodeData(data, key string) (string, error)
- func FenToYuanFloat(amount int64) float64
- func FenToYuanFormat(price int64) string
- func FenToYuanStr(amount int64) string
- func FloatDiv100(amount float64) float64
- func FloatDiv100Str(amount float64) string
- func FloatMul100(amount float64) float64
- func FloatMul100Str(str string) string
- func GCSummary() string
- func GetDataMonth(timeObj time.Time, monthNum int) int64
- func GetLocalIp() (ipv4 string, err error)
- func GetRandomStr(num int) string
- func GetRandomStrToken(num int) string
- func GetReplaceSql(str string) string
- func GetReplaceSqlMysql(str string) string
- func GetSerialNumber(fix string, userId int64, num int) string
- func GetVerifyCode(num int) string
- func ImportDataUnix(str string) int64
- func Ip2long(ipstr string) uint32
- func MyMd5(str string) string
- func NewRequestId() context.Context
- func PM12() int64
- func ReadFile(fileName string) ([]byte, error)
- func RemoteIp(req *http.Request) string
- func Sex(id string) string
- func SharpClock() int64
- func Str2bytes(s string) []byte
- func StrArrToInt64(list []string) (oList []int64, err error)
- func StrToDate(str, format string) time.Time
- func Substr(str string, start, length int) string
- func TimeSprintf(d time.Duration) string
- func ToH(bytes uint64) string
- func UnixPM12() int64
- func Validate(id string) (flag bool, err error)
- func ValidateArea(id string) error
- func ValidateBirth(id string) error
- func ValidateReg(id string) error
- func ValidateSum(id string) error
- func YuanToFenFloat(amount float64) int64
- func YuanToFenStr(amount string) (int64, error)
- type RegexCheck
- func (ic *RegexCheck) CheckPwd(str string) bool
- func (ic *RegexCheck) IsCellphone(str ...string) bool
- func (ic *RegexCheck) IsDecimals(str ...string) bool
- func (ic *RegexCheck) IsEmail(str ...string) bool
- func (ic *RegexCheck) IsEngishLowCase(str ...string) bool
- func (ic *RegexCheck) IsEnglish(str ...string) bool
- func (ic *RegexCheck) IsEnglishCap(str ...string) bool
- func (ic *RegexCheck) IsID(str ...string) bool
- func (ic *RegexCheck) IsInteger(str ...string) bool
- func (ic *RegexCheck) IsLen(str string, min, max int) bool
- func (ic *RegexCheck) IsPwd(str ...string) bool
- func (ic *RegexCheck) IsTelephone(str ...string) bool
Constants ¶
View Source
const ( XForwardedFor = "X-Forwarded-For" XRealIP = "X-Real-IP" )
View Source
const ( NUmStr = "0123456789" CharStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" )
View Source
const DATE_FORMAT = "2006-01-02 15:04:05"
View Source
const DATE_FORMAT_HIS = "150405"
View Source
const DATE_FORMAT_MD = "0102"
View Source
const DATE_FORMAT_MDY = "01-02-06"
View Source
const DATE_FORMAT_MDYHIS = "01/02/2006 15:04:05"
View Source
const DATE_FORMAT_YDM = "01/02/2006"
View Source
const DATE_FORMAT_YM = "2006-01"
View Source
const DATE_FORMAT_YMD = "2006-01-02"
View Source
const DATE_FORMAT_YMD01 = "2006-1-02"
View Source
const DATE_FORMAT_YMD02 = "2006-1-2"
View Source
const DATE_FORMAT_YMD03 = "2006-01-2"
View Source
const DATE_FORMAT_YMD1 = "20060102"
View Source
const (
PRERNG = 1024
)
View Source
const YYMMDDHHII_DATE_FORMAT = "2006-01-02 15:04"
View Source
const YYMMDDHHII_FORMAT = "0601021504"
Variables ¶
View Source
var ( ErrFormatInvalid = errors.New("格式错误") ErrAddressInvalid = errors.New("地址码错误") ErrBirthFormatInvalid = errors.New("出生日期格式错误") ErrBirthRangeInvalid = errors.New("出生日期范围错误") ErrSumInvalid = errors.New("校验和错误") )
View Source
var (
LCG chan uint32
)
Functions ¶
func CreateOrderNumber ¶
func DateString ¶
func FenToYuanFloat ¶
func FenToYuanFormat ¶
func FenToYuanStr ¶
func FloatDiv100 ¶
func FloatDiv100Str ¶
func FloatMul100 ¶
func FloatMul100Str ¶
func GetLocalIp ¶ added in v0.0.20
func GetRandomStr ¶
func GetRandomStrToken ¶
func GetReplaceSql ¶
func GetReplaceSqlMysql ¶
func GetVerifyCode ¶
func ImportDataUnix ¶
func NewRequestId ¶ added in v0.0.36
func SharpClock ¶
func SharpClock() int64
------------------------------------------------ 返回当前的整点时间
func StrArrToInt64 ¶
func YuanToFenFloat ¶
func YuanToFenStr ¶
Types ¶
type RegexCheck ¶
type RegexCheck struct { }
func (*RegexCheck) IsCellphone ¶
func (ic *RegexCheck) IsCellphone(str ...string) bool
phone (不带前缀)最高11位
func (*RegexCheck) IsTelephone ¶
func (ic *RegexCheck) IsTelephone(str ...string) bool
telephone(不带前缀) 最高8位
Click to show internal directories.
Click to hide internal directories.