apiresp

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 6 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 v0.0.49

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