response

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoResponse

func NoResponse(_ *api.Context, _ int, _ any, _ error)

func SendIDResponse

func SendIDResponse(c *api.Context, statusCode int, id string, err error)

func SendInfoResponse

func SendInfoResponse[T any](c *api.Context, statusCode int, info T, err error)

func SendInfosResponse

func SendInfosResponse[T any](c *api.Context, statusCode int, data InfosData[T], err error)

func SendMapResponse

func SendMapResponse(c *api.Context, statusCode int, data map[string]any, err error)

func SendMsgResponse

func SendMsgResponse(c *api.Context, statusCode int, _ any, err error)

func SendString

func SendString(c *api.Context, statusCode int, data string, err error)

func SendWXOrderResponse

func SendWXOrderResponse(c *api.Context, statusCode int, _ any, err error)

func StructToMap

func StructToMap(originStruct any) map[string]any

func WSSendMessage

func WSSendMessage(groupID string, obj any)

func WriteBytes

func WriteBytes(c *api.Context, statusCode int, bytes []byte, err error)

Types

type IDResponse

type IDResponse struct {
	MsgResponse
	ID string `json:"id"`
}

type InfoResponse

type InfoResponse[T any] struct {
	MsgResponse
	Info T `json:"info"`
}

type InfosData

type InfosData[T any] struct {
	Infos      []T   `json:"infos"`
	TotalCount int64 `json:"totalCount"`
	PageNo     int   `json:"pageNo"`
}

type InfosResponse

type InfosResponse[T any] struct {
	MsgResponse
	InfosData[T]
}

type MsgResponse

type MsgResponse struct {
	Success bool   `json:"success"`
	ErrCode int    `json:"errCode"`
	Msg     string `json:"msg"`
}

type WXOrderResponse

type WXOrderResponse struct {
	ReturnCode string `xml:"return_code"`
	ReturnMsg  string `xml:"return_msg"`
}

Jump to

Keyboard shortcuts

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