apiresp

package
v0.0.50-alpha.46-20241209 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 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

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