apiresp

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinError

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

func GinSuccess

func GinSuccess(c *gin.Context, data any)

func HttpError

func HttpError(w http.ResponseWriter, err error)

func HttpSuccess

func HttpSuccess(w http.ResponseWriter, data any)

Types

type ApiFormat

type ApiFormat interface {
	ApiFormat()
}

type ApiResponse

type ApiResponse struct {
	ErrCode int    `json:"errCode"`
	ErrMsg  string `json:"errMsg"`
	ErrDlt  string `json:"errDlt"`
	Data    any    `json:"data,omitempty"`
}

func ApiSuccess

func ApiSuccess(data any) *ApiResponse

func GetGinApiResponse added in v1.1.0

func GetGinApiResponse(c *gin.Context) *ApiResponse

func ParseError

func ParseError(err error) *ApiResponse

func (*ApiResponse) MarshalJSON

func (r *ApiResponse) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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