response

package
v0.0.0-...-d402f94 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bad

func Bad(c *gin.Context, code int, data interface{}, msg ...string)

Bad 失败响应,需要Data

func Error

func Error(c *gin.Context, err error, msg ...string)

Error 响应 404 或 422,未传参 msg 时使用默认消息 处理请求时出现错误 err,会附带返回 error 信息,如登录错误、找不到 ID 对应的 Model

func Error404

func Error404(c *gin.Context, msg ...string)

Error404 响应 404,未传参 msg 时使用默认消息

func Error500

func Error500(c *gin.Context, msg ...string)

Error500 响应 500,未传参 msg 时使用默认消息

func Fail

func Fail(c *gin.Context, code int, args ...interface{})

Fail 失败响应,不需要Data

func HTML

func HTML(c *gin.Context, path string, data interface{})

HTML 渲染

func JSON

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

JSON 响应 200 和 JSON 数据,没有code

func Ok

func Ok(c *gin.Context, code int)

Ok 成功响应,不需要Data数据

func Render

func Render(c *gin.Context, path string, data interface{})

Render 渲染

func Success

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

Success 成功响应,需要Data数据

func ToHtml

func ToHtml(c *gin.Context, p string, data interface{})

ToHtml 服务端渲染页面

Types

This section is empty.

Jump to

Keyboard shortcuts

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