handler

package
v0.0.0-...-d01447b Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTP404      = NewApiError(404, "资源不存在或已删除")
	HTTP405      = NewApiError(405, "不合法的请求方式")
	NotCompleted = NewApiError(1000, "功能未完成")
)

Functions

func Handle404

func Handle404(c *gin.Context)

自定义 404 处理

func Handle405

func Handle405(c *gin.Context)

自定义 405 处理

func NewHTMLResponse

func NewHTMLResponse() *html

实例化 html 响应

func NewJSONResponse

func NewJSONResponse() *json

实例化 json 响应

func Registry

func Registry(e *gin.Engine, router *gin.RouterGroup)

注册全局接口或视图 look: 请勿将 `engine` 对象传给用户业务

func U

func U(url string) string

url 统一处理

Types

type ApiErr

type ApiErr struct {
	Message string
	Code    int
}

func NewApiError

func NewApiError(code int, msg string) ApiErr

func (ApiErr) Error

func (a ApiErr) Error() string

Directories

Path Synopsis
api
v1
v2

Jump to

Keyboard shortcuts

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