common

package
v0.0.0-...-47484d2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ContextUserID = "userID"

ContextUserID .

View Source
const TIMESTAMP = time.RFC3339

TIMESTAMP 是序列号时间戳的格式

Variables

View Source
var HTTPClient *resty.Client = resty.New()

HTTPClient is the common HTTP client in project

View Source
var JWTRefreshTokenExpDuration time.Duration

JWTRefreshTokenExpDuration 是 jwt refresh token 有效的时长

View Source
var JWTSecret string

JWTSecret 是 jwt token 的秘钥

View Source
var JWTTokenExpDuration time.Duration

JWTTokenExpDuration 是 jwt token 有效的时长

View Source
var Logger = logrus.New()

Logger is the common log agency in project

View Source
var MySQLClient *gorm.DB

MySQLClient is the common MySQL client in project

View Source
var RedisClient *redis.Client

RedisClient is the common Redis client in project

Functions

This section is empty.

Types

type BaseHandler

type BaseHandler interface {
	RegisterPublicRoutes(r *gin.RouterGroup)
	RegisterPrivateRoutes(r *gin.RouterGroup)
}

BaseHandler can register gin router group

type ResponseError

type ResponseError struct {
	// contains filtered or unexported fields
}

ResponseError contains error message, description, and statusCode

func NewResponseError

func NewResponseError(message string, description interface{}, statusCode int) *ResponseError

NewResponseError create new ResponseError with specific info

func NewResponseErrorWithErr

func NewResponseErrorWithErr(message string, err error, statusCode int) *ResponseError

NewResponseErrorWithErr create new ResponseError, with err as description

func (ResponseError) Abort

func (r ResponseError) Abort(c *gin.Context)

Abort will abort passed gin reqest and respose the error

func (ResponseError) Error

func (r ResponseError) Error() string

Jump to

Keyboard shortcuts

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