response

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 8 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 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 Success

func Success(msg string, data any) *Response

func SuccessCus

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

Jump to

Keyboard shortcuts

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