mqtt_response

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoResponse

func NoResponse(_ *mqtt_api.Context, _ string, _ any, _ error)

func SendIDResponse

func SendIDResponse(c *mqtt_api.Context, identifier string, id string, err error)

func SendInfoResponse

func SendInfoResponse[T any](c *mqtt_api.Context, identifier string, info T, err error)

func SendInfosResponse

func SendInfosResponse[T any](c *mqtt_api.Context, identifier string, data InfosData[T], err error)

func SendMapResponse

func SendMapResponse(c *mqtt_api.Context, identifier string, data map[string]any, err error)

func SendMsgResponse

func SendMsgResponse(c *mqtt_api.Context, identifier string, _ any, err error)

func SendString

func SendString(c *mqtt_api.Context, identifier string, data string, err error)

func StructToMap

func StructToMap(originStruct any) map[string]any

func WriteBytes

func WriteBytes(c *mqtt_api.Context, identifier string, 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 SendResponseFunc

type SendResponseFunc[T any] func(c *mqtt_api.Context, identifier string, data T, err error)

Jump to

Keyboard shortcuts

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