httpx

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SERVER_ERROR    = 1000 // 系统错误
	NOT_FOUND       = 1001 // 401错误
	UNKNOWN_ERROR   = 1002 // 未知错误
	PARAMETER_ERROR = 1003 // 参数错误
	GRPC_ERROR      = 1004 // 错误
	AUTH_ERROR      = 1005 // 认证错误
)

Variables

This section is empty.

Functions

func Cors

func Cors() gin.HandlerFunc

func GetRealIP

func GetRealIP(c *gin.Context) string

func Wrapper

func Wrapper(handler HandlerFunc) func(c *gin.Context)

Types

type APIException

type APIException struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func Exception

func Exception(code int, message string, args ...interface{}) *APIException

其他错误

func GRPCError

func GRPCError(s *status.Status) *APIException

grpc错误

func NotFound

func NotFound() *APIException

404 错误

func ParameterError

func ParameterError(message string) *APIException

参数错误

func ServerError

func ServerError() *APIException

500 错误处理

func UnauthorizedError

func UnauthorizedError() *APIException

401认证错误

func UnknownError

func UnknownError(message string) *APIException

未知错误

func (*APIException) Error

func (e *APIException) Error() string

实现接口

type HandlerFunc

type HandlerFunc func(c *gin.Context) error

Jump to

Keyboard shortcuts

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