responseutil

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(c *gin.Context, additionalInfo string)

Error response error message

func ErrorWithCode

func ErrorWithCode(c *gin.Context, code ResponseCode, msg string)

func GinResponseObj

func GinResponseObj(o *ResponseObj) gin.H

GinResponseObj convert ResponseObj into gin.H

func Success

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

Types

type ResponseCode

type ResponseCode int32

ResponseCode define the new type for response code

const (
	// RSuccess is success status
	RSuccess ResponseCode = 200
	// Client Error
	RClientError ResponseCode = 400
	// Server Error
	RServerError ResponseCode = 500
	// ROther is other status
	ROther
)

type ResponseObj

type ResponseObj struct {
	Code ResponseCode `json:"code"`
	Data interface{}  `json:"data"`
}

ResponseObj define a response object

Jump to

Keyboard shortcuts

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