response

package
v1.3.20 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoResponse added in v1.1.3

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

func SendIDResponse

func SendIDResponse[T IDType](c *binding_context.Context, statusCode int, id T, err error)

func SendInfoResponse

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

func SendInfosResponse

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

func SendMapResponse

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

func SendMsgResponse

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

func SendString added in v1.1.2

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

func SendWXOrderResponse added in v1.1.5

func SendWXOrderResponse(c *binding_context.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 added in v1.1.2

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

Types

type IDResponse

type IDResponse[T IDType] struct {
	MsgResponse
	ID T `json:"id"`
}

type IDType

type IDType interface {
	~string | ~uint64
}

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 SendFunc

type SendFunc[T any] func(c *binding_context.Context, statusCode int, data T, err error)

Jump to

Keyboard shortcuts

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