Documentation ¶
Overview ¶
Package util implements some simple tools function for the project
Index ¶
- func BcryptAuth(pw, hash string) bool
- func CheckEmail(email string) (b bool)
- func CheckNickName(nickname string) bool
- func CreateJWTToken(secretKey, method string, claims jwt.Claims) (string, error)
- func GetBcryptHash(pw string) string
- func GetGraphqlArgs(args map[string]FieldArg) graphql.FieldConfigArgument
- func ValidateJWTToken(tokenString, secretKey string, claims *CustomClaims) (bool, error)
- type CustomClaims
- type FieldArg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BcryptAuth ¶
BcryptAuth util bcrypt_password authentification @param captain [description]
func CreateJWTToken ¶
CreateJWTToken util
func GetBcryptHash ¶
GetBcryptHash util GetBcryptHash @param pw the password you need to encrypt
func GetGraphqlArgs ¶
func GetGraphqlArgs(args map[string]FieldArg) graphql.FieldConfigArgument
GetGraphqlArgs util (已弃用,感觉写了也没变简洁)
func ValidateJWTToken ¶
func ValidateJWTToken(tokenString, secretKey string, claims *CustomClaims) (bool, error)
ValidateJWTToken util
Types ¶
type CustomClaims ¶
type CustomClaims struct { UserID int `json:"user_id"` Email string `json:"email"` jwt.StandardClaims }
CustomClaims util
Click to show internal directories.
Click to hide internal directories.