dashboard_middleware

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoveryMiddleware

func RecoveryMiddleware() gin.HandlerFunc

func RequestLogger

func RequestLogger(serName string) gin.HandlerFunc

func ResponseError

func ResponseError(c *gin.Context, code ResponseCode, err error)

func ResponseSuccess

func ResponseSuccess(c *gin.Context, data interface{})

func SessionAuthMiddleware

func SessionAuthMiddleware() gin.HandlerFunc

func TranslationMiddleware

func TranslationMiddleware() gin.HandlerFunc

设置Translation

Types

type Response

type Response struct {
	ErrorCode ResponseCode `json:"errno"`
	ErrorMsg  string       `json:"errmsg"`
	Data      interface{}  `json:"data"`
	TraceId   interface{}  `json:"trace_id"`
	Stack     interface{}  `json:"stack"`
}

type ResponseCode

type ResponseCode int
const (
	SuccessCode ResponseCode = iota
	UndefErrorCode
	ValidErrorCode
	InternalErrorCode
	InvalidRequestErrorCode ResponseCode = 401
	CustomizeCode           ResponseCode = 1000
)

1000以下为通用码,1000以上为用户自定义码

Jump to

Keyboard shortcuts

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