response

package
v0.0.0-...-c621b08 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code int

Code 响应码枚举类

const (
	Success             Code = 1000 // 成功
	Error               Code = 1001 // 一般错误
	NotFound            Code = 1002 // 未找到
	InternalServerError Code = 1003 // 服务器错误
	ParameterError      Code = 1004 // 参数错误
	Unauthorized        Code = 1005 // 未授权
	RegisterDisabled    Code = 1006 // 注册已关闭
)

type ContextEx

type ContextEx struct {
	*gin.Context
}

ContextEx 扩展 Context

func (*ContextEx) Bind

func (c *ContextEx) Bind(obj any) error

Bind 绑定查询参数

func (*ContextEx) BindJSON

func (c *ContextEx) BindJSON(obj any) error

BindJSON 绑定 JSON

func (*ContextEx) BindQuery

func (c *ContextEx) BindQuery(obj any) error

BindQuery 绑定查询参数

func (*ContextEx) BindWith

func (c *ContextEx) BindWith(obj any, binding binding.Binding) error

BindWith 绑定查询参数

func (*ContextEx) Failure

func (c *ContextEx) Failure(code Code, msg string)

Failure 失败响应

func (*ContextEx) InternalServerError

func (c *ContextEx) InternalServerError()

InternalServerError 服务器错误响应

func (*ContextEx) LoginError

func (c *ContextEx) LoginError()

LoginError 登录错误响应

func (*ContextEx) NoContent

func (c *ContextEx) NoContent()

NoContent 无内容响应

func (*ContextEx) NotFound

func (c *ContextEx) NotFound()

NotFound 未找到响应

func (*ContextEx) ParameterError

func (c *ContextEx) ParameterError()

ParameterError 参数错误响应

func (*ContextEx) RegisterDisabled

func (c *ContextEx) RegisterDisabled()

RegisterDisabled 注册已关闭响应

func (*ContextEx) Response

func (c *ContextEx) Response(status int, code Code, msg string, data interface{})

Response 响应

func (*ContextEx) Success

func (c *ContextEx) Success(data ...interface{})

Success 成功响应

func (*ContextEx) Unauthorized

func (c *ContextEx) Unauthorized()

Unauthorized 未授权响应

Jump to

Keyboard shortcuts

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