Documentation
¶
Index ¶
- Constants
- func CellphoneCheckRule() string
- func EmailCheckRule() string
- func FakeIdCartNumber() string
- func GeneratePassword(password string) (string, string)
- func Int64InArrayIndex(x int64, array []int64) int
- func IntInArrayIndex(x int, array []int) int
- func IsCellphone(phone string) bool
- func IsEmail(email string) bool
- func IsIdCardNumber(card string) bool
- func Md5(str string) string
- func MkdirIfNotExist(dir string) error
- func RandomNumberStr(i ...int) string
- func RandomStr(i ...int) string
- func StrInArrayIndex(str string, array []string) int
- func TotalPage(size, total int) int
- func UUID() string
- func VerifyPassword(password, hashPwd, salt string) bool
- type Captcha
- func (c *Captcha) GenerateLettersImage() (code string, b64s string, err error)
- func (c *Captcha) GenerateMathImage() (code string, b64 string, err error)
- func (c *Captcha) GenerateNumberImage() (code string, b64s string, err error)
- func (c *Captcha) SetBgColor(rgba color.RGBA)
- func (c *Captcha) SetFonts(fonts []string)
- func (c *Captcha) SetStore(store base64Captcha.Store)
- func (c *Captcha) Verify(id, answer string) (match bool)
- type CaptchaRedisStore
- type IdCartInfo
- type LocalTime
Constants ¶
View Source
const ( DateLayout = "2006-01-02" DateTimeLayout = "2006-01-02 15:04:05" DateLayoutSlash = "2006/01/02" DateTimeLayoutSlash = "2006/01/02 15:04:05" DateShortLayout = "06-01-02" DateShortLayoutSlash = "06/01/02" MonthDateLayout = "01-02" MonthDateLayoutSlash = "01/02" TimeLayout = "15:04:05" TimeMinuteLayout = "15:04" )
View Source
const NormalLetters string = "abcdefghjkmnopqrstuvwxyzABCDEFGHJKMNOPQRSTUVWXYZ123456789"
View Source
const NumberLetters string = "0123456789"
Variables ¶
This section is empty.
Functions ¶
func GeneratePassword ¶
GeneratePassword 生成密码串和盐
func Int64InArrayIndex ¶
func IntInArrayIndex ¶
func IsIdCardNumber ¶
IsIdCardNumber 校验身份证号码规则,支持15位、18位及末位X,且会验证身份证号的合法性
func MkdirIfNotExist ¶
func StrInArrayIndex ¶
Types ¶
type Captcha ¶
func NewCaptcha ¶
func (*Captcha) GenerateLettersImage ¶
GenerateLettersImage 生成数字与字母混合的验证码和图片
func (*Captcha) GenerateMathImage ¶
GenerateMathImage 生成算术验证码和图片
func (*Captcha) GenerateNumberImage ¶
GenerateNumberImage 生成全数字验证码和图片
func (*Captcha) SetBgColor ¶
func (*Captcha) SetStore ¶
func (c *Captcha) SetStore(store base64Captcha.Store)
type CaptchaRedisStore ¶
type CaptchaRedisStore struct {
// contains filtered or unexported fields
}
func NewCaptchaRedisStore ¶
func NewCaptchaRedisStore(client *redis.Client, keyPrefix string) *CaptchaRedisStore
func (*CaptchaRedisStore) SetExpiration ¶
func (c *CaptchaRedisStore) SetExpiration(expiration time.Duration)
type IdCartInfo ¶
type IdCartInfo idvalidator.IdInfo
func GetIdCartInfo ¶
func GetIdCartInfo(card string) (*IdCartInfo, error)
GetIdCartInfo 严格模式获取身份证号信息 []interface {}[
github.com/guanguans/id-validator.IdInfo{ // 身份证号信息 AddressCode: int(500154) // 地址码 Abandoned: int(0) // 地址码是否废弃:1为废弃的,0为正在使用的 Address: string("重庆市市辖区开州区") // 地址 AddressTree: []string[ // 省市区三级列表 string("重庆市") // 省 string("市辖区") // 市 string("开州区") // 区 ] Birthday: <1993-01-13 00:00:00 +0800 CST> // 出生日期 Constellation: string("摩羯座") // 星座 ChineseZodiac: string("酉鸡") // 生肖 Sex: int(0) // 性别:1为男性,0为女性 Length: int(18) // 号码长度 CheckBit: string("6") // 校验码 } <nil> // 错误信息
]
Click to show internal directories.
Click to hide internal directories.