mqtt_binding

package
v1.3.11-alpha3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind[I any, O any](b *Binding, item *BindItem[I, O], handlers ...router.Handler)

func Destroy

func Destroy()

func Init

func Init(prefix string, opts *mqtt_client.MqttClientOptions) error

Types

type BindItem

type BindItem[I any, O any] struct {
	Topic               string               // 请求路径
	ResponseIdentifier  response.Identifier  // 响应标识符提供接口,会在响应主题添加该标识符
	ResponseFunc        response.SendFunc[O] // 响应泛型函数
	BusinessFunc        BusinessFunc[I, O]   // 业务泛型函数
	OptionalBindingFunc BindingFunc[O]       // 可选的绑定函数
}

BindItem 路由条目结构

type Binding

type Binding struct {
	// contains filtered or unexported fields
}

func NewBinding

func NewBinding(apiVersion string, responseIdentifier response.Identifier, handlers ...router.Handler) *Binding

NewBinding 创建版本对应的binding

func (*Binding) AddHandler

func (binding *Binding) AddHandler(topic string, handlers ...router.Handler) error

type BindingFunc

type BindingFunc[O any] func(c *mqtt_client.MqttClient, item *router.Item, request any, sendFunc response.SendFunc[O]) bool

type BusinessFunc

type BusinessFunc[I any, O any] func(c *mqtt_client.MqttClient, inputModel I) (O, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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