response

package
v0.0.0-...-d125d34 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abort

func Abort(c *gin.Context, httpCode int, errorCode, errorMessage string)

func AbortWithError

func AbortWithError(c *gin.Context, err error)

AbortWithError TODO: remove this function after all error changed to rpcerror.RPCError

func AbortWithForbiddenError

func AbortWithForbiddenError(c *gin.Context, code, errMessage string)

func AbortWithInternalError

func AbortWithInternalError(c *gin.Context, message string)

func AbortWithNotExistError

func AbortWithNotExistError(c *gin.Context, message string)

func AbortWithRPCError

func AbortWithRPCError(c *gin.Context, rpcError rpcerror.RPCError)

func AbortWithRequestError

func AbortWithRequestError(c *gin.Context, errorCode, errorMessage string)

func AbortWithUnauthorized

func AbortWithUnauthorized(c *gin.Context, code, errMessage string)

func Success

func Success(c *gin.Context)

func SuccessWithData

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

Types

type DataWithTotal

type DataWithTotal struct {
	Total int64       `json:"total"`
	Items interface{} `json:"items"`
}

type Response

type Response struct {
	ErrorCode    string      `json:"errorCode,omitempty"`
	ErrorMessage string      `json:"errorMessage,omitempty"`
	Data         interface{} `json:"data,omitempty"`
	RequestID    string      `json:"requestID,omitempty"`
}

func NewResponse

func NewResponse() *Response

func NewResponseWithData

func NewResponseWithData(data interface{}) *Response

Jump to

Keyboard shortcuts

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