Documentation ¶
Index ¶
- func AnyToDecimal(num string, n int) int64
- func CheckPasswordLever(ps string) int32
- func CheckUserName(name string) error
- func Convert(src interface{}, dst interface{}) interface{}
- func CreateToken(secretKey string, claims CustomClaims) (string, error)
- func DecimalToAny(num, n int64) string
- func FuncName() string
- func GetIP(r *http.Request) (string, error)
- func GetJwtToken(secretKey string, iat, seconds, uid int64) (string, error)
- func GetLoginNameType(userName string) def.UserInfoType
- func GetPassword(length int, level int) string
- func GetPwdBase64(length int) string
- func HandleThrow(p interface{})
- func HmacSha1(data string, secret []byte) string
- func HmacSha256(data string, secret []byte) string
- func Ip2binary(ip string) string
- func IsEmail(email string) bool
- func IsMobile(mobile string) bool
- func MD5V(str []byte) string
- func MakePwd(pwd string, uid int64, isMd5 bool) string
- func MatchIP(ip, iprange string) bool
- func RefreshToken(tokenString string, secretKey string) (string, error)
- func SetVal(key interface{}, src, dst interface{}) (num int)
- func SetVals(src interface{}, dst interface{}) (num int)
- func ToLen(src string, length int) string
- func Unmarshal(data []byte, v interface{}) error
- type CheckExp
- type CustomClaims
- type ExpMap
- type SnowFlake
- func (c *SnowFlake) GetMachineId() int64
- func (c *SnowFlake) GetSnowflakeId() (id int64)
- func (c *SnowFlake) MilliSecondToTime(milliSecond int64) (t time.Time)
- func (c *SnowFlake) MillisecondToTimeDb(ts int64) string
- func (c *SnowFlake) MillisecondToTimeTz(ts int64) string
- func (c *SnowFlake) ParseId(id int64) (milliSecond, mId, sn int64)
- func (c *SnowFlake) SetMachineId(mId int64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
func Convert(src interface{}, dst interface{}) interface{}
@in src 赋值的数据源 @in dst 赋值对象的结构体 @out dst类型的结构体
func CreateToken ¶
func CreateToken(secretKey string, claims CustomClaims) (string, error)
创建一个token
func GetLoginNameType ¶
func GetLoginNameType(userName string) def.UserInfoType
func GetPassword ¶
@in len 密码的长度 @in level 密码的强度级别 0:包含数字和字母 1:包含数字字母和特殊字符
func GetPwdBase64 ¶
func HandleThrow ¶
func HandleThrow(p interface{})
func HmacSha256 ¶
Types ¶
type CustomClaims ¶
type CustomClaims struct { Uid int64 jwt.StandardClaims }
Custom claims structure
func ParseToken ¶
func ParseToken(tokenString string, secretKey string) (*CustomClaims, *errors.CodeError)
解析 token
type SnowFlake ¶
type SnowFlake struct {
// contains filtered or unexported fields
}
func NewSnowFlake ¶
var Snow = &SnowFlake{ lastTime: time.Now().UnixNano() / 1000000, machineID:1, }
func (*SnowFlake) GetSnowflakeId ¶
获取雪花 返回值 id:自增id ts:生成该id的毫秒时间戳
func (*SnowFlake) MilliSecondToTime ¶
毫秒转换成time
func (*SnowFlake) MillisecondToTimeDb ¶
毫秒转换成"2006-01-02 15:04:05.999"
func (*SnowFlake) MillisecondToTimeTz ¶
毫秒转换成"20060102T150405.999Z"
Click to show internal directories.
Click to hide internal directories.