response

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attachment

func Attachment(ctx echo.Context, file string, name string) error

下载附件

func File

func File(ctx echo.Context, file string) error

下载文件

func HTML

func HTML(ctx echo.Context, html string) error

响应字符输出

func IsAjax

func IsAjax(ctx echo.Context) bool

IsAjax

func JSON

func JSON(ctx echo.Context, i any) error

响应 JSON

func JSONP

func JSONP(ctx echo.Context, callback string, i any) error

响应 JSONP

func JSONString

func JSONString(ctx echo.Context, i any) error

json

func Redirect

func Redirect(ctx echo.Context, url string) error

跳转

func Render

func Render(ctx echo.Context, name string, data any) error

响应模板

func ReturnErrorJson

func ReturnErrorJson(ctx echo.Context, msg string) error

返回错误 json

func ReturnJson

func ReturnJson(
	ctx echo.Context,
	code int,
	msg string,
	data any,
) error

返回 json

func ReturnSuccessJson

func ReturnSuccessJson(ctx echo.Context, msg string, data any) error

返回成功 json

func Stream

func Stream(ctx echo.Context, contentType string, r io.Reader) error

响应数据流

func String

func String(ctx echo.Context, str string) error

响应字符

func XML

func XML(ctx echo.Context, i any) error

响应 XML

Types

type JSONResult

type JSONResult struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

*

  • json 返回数据 *
  • @create 2022-12-30
  • @author deatil

Jump to

Keyboard shortcuts

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