Response

package
v0.0.0-...-0f65a33 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: BSD-2-Clause Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerError = NewApiError(codes.Internal, "系统错误,请稍后重试")
View Source
var Success = NewApiError(codes.OK, "")

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Code codes.Code `json:"code"`
	Msg  string     `json:"msg"`
}

统一 error 信息输出 当没有错误时,返回的code 为0,msg 为"" 这里基本指的是 grpc 的错误

func NewApiError

func NewApiError(code codes.Code, msg string) *ApiError

func (*ApiError) Error

func (ae *ApiError) Error() string

type StdInfoResp

type StdInfoResp struct {
	*ApiError
	Data interface{} `json:"data"`
}

统一信息返回

func NewStdInfoResp

func NewStdInfoResp(data interface{}, err error) *StdInfoResp

这里可以将返回的信息进行分类

func (*StdInfoResp) Error

func (sir *StdInfoResp) Error() string

Jump to

Keyboard shortcuts

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