resp

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FuncResp func(info *ResponseInfo) interface{}

Functions

func FormatResp added in v1.0.1

func FormatResp(funcResp func(info *ResponseInfo) interface{})

func GetResp added in v1.0.1

func GetResp(info *ResponseInfo) interface{}

Types

type ErrorMsg

type ErrorMsg struct {
	Errno  int
	Reason string
}

func BadRequestErr2Json

func BadRequestErr2Json(err error) *ErrorMsg

func Err2Json

func Err2Json(code int, err error) *ErrorMsg

func InternalServerErr2Json

func InternalServerErr2Json(err error) *ErrorMsg

func NotFoundErr2Json

func NotFoundErr2Json(err error) *ErrorMsg

type ResponseInfo added in v1.0.1

type ResponseInfo struct {
	Code  int         `json:"code,omitempty"`
	Data  interface{} `json:"data,omitempty"`
	Error string      `json:"error,omitempty"`
}

func CreateData added in v1.0.1

func CreateData(data interface{}) *ResponseInfo

func Failure

func Failure(msg string) *ResponseInfo

func FailureStatus added in v1.0.1

func FailureStatus(status int, msg string) *ResponseInfo

func Success

func Success() *ResponseInfo

func SuccessData

func SuccessData(data interface{}) *ResponseInfo

Jump to

Keyboard shortcuts

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