Documentation
¶
Index ¶
- Variables
- func ContainsStr(arr []string, target string) bool
- func GenerateTokens(username string, userID int64) (string, string, error)
- func IsExpire(token string) bool
- func ParseRawToken(rawToken string) string
- func RefreshToken(rawToken string) (string, error)
- func WrapHandlerFunctions(rawFuncs ...http.HandlerFunc) []gin.HandlerFunc
- type Claims
- type IDGenerator
- type ShutdownHook
- type Validator
- func (v *Validator) CheckBoolValue(key string, expect bool, got bool) *Validator
- func (v *Validator) CheckInt64Value(key string, expect int64, got int64) *Validator
- func (v *Validator) CheckIntValue(key string, expect int, got int) *Validator
- func (v *Validator) CheckStringValue(key string, expect string, got string) *Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TokenInvalid = errors.New("invalid token") TokenExpired = errors.New("token is expired") )
View Source
var Generator = &IDGenerator{}
Functions ¶
func ContainsStr ¶
func ParseRawToken ¶
func RefreshToken ¶
func WrapHandlerFunctions ¶
func WrapHandlerFunctions(rawFuncs ...http.HandlerFunc) []gin.HandlerFunc
Types ¶
type Claims ¶
type Claims struct { Username string `json:"username"` UserID int64 `json:"userID"` IsRefresh bool `json:"isRefresh"` jwt.StandardClaims }
func ParseAccessToken ¶
func ParseRefreshToken ¶
type IDGenerator ¶
type IDGenerator struct {
// contains filtered or unexported fields
}
func (*IDGenerator) GenerateID ¶
func (g *IDGenerator) GenerateID() int64
type ShutdownHook ¶
type ShutdownHook interface { // WithSignals add more signals into hook WithSignals(signals ...syscall.Signal) ShutdownHook // Close register shutdown handles Close(funcs ...func()) }
Hook a graceful shutdown hook, default with signals of SIGINT and SIGTERM
type Validator ¶
type Validator struct { Operation string // contains filtered or unexported fields }
func (*Validator) CheckBoolValue ¶
func (*Validator) CheckInt64Value ¶
func (*Validator) CheckIntValue ¶
Click to show internal directories.
Click to hide internal directories.