response

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ERROR Default error code returned
	ERROR = 403
	//SUCCESS Default success code return
	SUCCESS = 200
)

Variables

This section is empty.

Functions

func HTML

func HTML(result interface{}, name string, c *gin.Context, code ...int)

HTML ...

func Json

func Json(result interface{}, c *gin.Context, code ...int)

Json ...

func Jsonp

func Jsonp(result interface{}, c *gin.Context, code ...int)

Jsonp ...

func ProtoBuf

func ProtoBuf(result interface{}, c *gin.Context, code ...int)

ProtoBuf ...

func PureJSON

func PureJSON(result interface{}, c *gin.Context, code ...int)

PureJSON ...

func String

func String(result interface{}, format string, c *gin.Context, code ...int)

String ...

func XML

func XML(result interface{}, c *gin.Context, code ...int)

XML ...

func YAML

func YAML(result interface{}, c *gin.Context, code ...int)

YAML ...

Types

type Page

type Page struct {
	Total int64       `json:"total"` //Total total pages
	List  interface{} `json:"list"`  //List json data
}

Page Pagination return

type Write

type Write struct {
	Code  int         `json:"code"`  //Code
	Msg   string      `json:"msg"`   //Msg Prompt message
	Data  interface{} `json:"data"`  //Data
	Error string      `json:"error"` //Error message
}

Write Return parameter

func ErrorResponse

func ErrorResponse(err error) *Write

ErrorResponse Error output

func Fail

func Fail(msg string, err ...error) *Write

Fail Error return, the second parameter is passed back to the front end and printed

func Success

func Success(msg string, data ...interface{}) *Write

Success Successfully returned

Jump to

Keyboard shortcuts

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