global

package
v0.0.0-...-8cfa0df Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenKey = "access-token"
	//CKGToken the key of jwt payload in gin context
	CKGToken = "claims"
)
View Source
const (
	SuccessCode      = 200
	UnauthorizedCode = 401
	NotFoundCode     = 404
	SystemErrorCode  = 500
)
View Source
const (
	UnknownCacheErrorCode = 5001
	UnknownDBErrorCode    = 5002
)
View Source
const (
	NotFoundMsg           = "404 not found"
	SuccessMsg            = "success"
	UnauthorizedMsg       = "unauthorized, please re-authorize"
	ServerErrorMsg        = "server internal error"
	IllegalInputErrMsg    = "input is illegal"
	AccountPasswordErrMsg = "incorrect account or password"
	EmptyTokenErrMsg      = "token not obtained"
	TokenHasExpiredMsg    = "token has expired"
)
View Source
const (
	AccountPasswordErrCode = 4031
)
View Source
const (
	IllegalInputErrCode = 4001
)

Variables

View Source
var StrongPwd validator.Func = func(fl validator.FieldLevel) bool {
	pwd, ok := fl.Field().Interface().(string)
	if ok {
		return IsStrongPwd(pwd)
	}
	return false
}

StrongPwd Strong password validator.

Functions

func IsStrongPwd

func IsStrongPwd(s string) bool

isStrongPwd the password must contain three of uppercase and lowercase letters, numbers, and special characters, and the password length is 8-16

Types

type Error

type Error interface {
	//Code error code returned to the client
	Code() int
	//Msg error message returned to the client
	Msg() string
}

type ResponseError

type ResponseError struct {
	ErrCode int
	Reason  string
}

func (ResponseError) Code

func (re ResponseError) Code() int

func (ResponseError) Msg

func (re ResponseError) Msg() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL