Documentation ¶
Index ¶
- Constants
- Variables
- func BcryptCheck(password, hash string) bool
- func BcryptHash(password string) string
- func BeginOfMonth(t int64) int64
- func BeginOfWeek(t int64) int64
- func NewFromString(s string, prec int32) decimal.Decimal
- func NewFromStringMaxPrec(s string) decimal.Decimal
- func NextMonth(t int64) int64
- func PrecCut(v string, prec int32) string
- func WithShardingSuffix(tableName string, userId int64) string
- type CustomClaims
- type JWT
- type JwtContent
- type WrapCron
Constants ¶
View Source
const ExpiresTime = time.Hour * 24 * 10
View Source
const MaxPrec = 18
View Source
const (
StdTimeFormat = "2006-01-02 15:04:05"
)
Variables ¶
View Source
var ( TokenExpired = errors.New("Token is expired") TokenNotValidYet = errors.New("Token not active yet") TokenMalformed = errors.New("That's not even a token") TokenInvalid = errors.New("Couldn't handle this token:") )
View Source
var (
DecimalZeroMaxPrec = NewFromStringMaxPrec("0") // 0
)
View Source
var (
ShardingCount = 10 //分表数量
)
Functions ¶
func WithShardingSuffix ¶ added in v1.2.0
Types ¶
type CustomClaims ¶
type CustomClaims struct { JwtContent jwt.RegisteredClaims }
type JWT ¶
type JWT struct {
SigningKey []byte
}
func (*JWT) CreateClaims ¶
func (j *JWT) CreateClaims(baseClaims JwtContent) CustomClaims
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)
解析 token
type JwtContent ¶
Click to show internal directories.
Click to hide internal directories.