response

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PageResponse

type PageResponse struct {
	Total    int64 `json:"total"`
	Data     any   `json:"data"`
	PageNum  int   `json:"pageNum"`
	PageSize int   `json:"pageSize"`
	Pages    int   `json:"pages"`
	Size     int   `json:"size"`
}

func Page

func Page(total int64, data any, pageNum, pageSize, pages, size int) *PageResponse

type Response

type Response struct {
	Success      bool              `json:"success"`
	Code         int32             `json:"code"`
	Msg          string            `json:"msg,omitempty"`
	ResponseTime string            `json:"responseTime,omitempty"`
	TraceId      string            `json:"traceId,omitempty"`
	Data         any               `json:"data,omitempty"`
	Extend       map[string]string `json:"extend,omitempty"`
}

func Error

func Error(errType any, data any) (res *Response)

func ErrorCus

func ErrorCus(code int32, msg string, data any) *Response

func ErrorMsg added in v0.3.11

func ErrorMsg(msg string) *Response

func RpcError

func RpcError(err error) *Response

func RpcRsp

func RpcRsp(rsp, data any) *Response

func RpcRspByDataFieldName

func RpcRspByDataFieldName(rsp, data any, dataFieldName string) *Response

func Succ

func Succ() *Response

func SuccMsg added in v0.3.11

func SuccMsg(msg string) *Response

func Success

func Success(msg string, data any) *Response

func SuccessCus

func SuccessCus(msg string, data any, extend map[string]string) *Response

func (Response) RpcData added in v0.4.0

func (r Response) RpcData(data proto.Message)

Jump to

Keyboard shortcuts

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