3 Star 5 Fork 3

三三物联网/ssiot-core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
context.go 292 Bytes
一键复制 编辑 原始数据 按行查看 历史
三三物联网 提交于 2022-12-29 09:28 . up
package logger
import "context"
type loggerKey struct{}
func FromContext(ctx context.Context) (*Helper, bool) {
l, ok := ctx.Value(&loggerKey{}).(*Helper)
return l, ok
}
func NewContext(ctx context.Context, l *Helper) context.Context {
return context.WithValue(ctx, &loggerKey{}, l)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sansaniot/ssiot-core.git
git@gitee.com:sansaniot/ssiot-core.git
sansaniot
ssiot-core
ssiot-core
v1.6.3

搜索帮助