2 Star 1 Fork 0

法马智慧/fmgo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
context.go 562 Bytes
一键复制 编辑 原始数据 按行查看 历史
零海 提交于 2022-11-17 16:51 . 重构emqx日志
package emqx
import (
"context"
mqtt "github.com/eclipse/paho.mqtt.golang"
"strings"
)
type Context struct {
context.Context
Client mqtt.Client
Message mqtt.Message
URI string
Topic string
Buffer []byte
Body string
}
// NewContext 创建上下文
func NewContext(client mqtt.Client, msg mqtt.Message, path []string) *Context {
return &Context{
Context: context.Background(),
Message: msg,
Client: client,
Topic: msg.Topic(),
URI: strings.Join(path, "/"),
Buffer: msg.Payload(),
Body: string(msg.Payload()),
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/fmpt/fmgo.git
git@gitee.com:fmpt/fmgo.git
fmpt
fmgo
fmgo
v1.2.17

搜索帮助

A270a887 8829481 3d7a4017 8829481