4 Star 5 Fork 4

Plato/Service-Box-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
options.go 612 Bytes
一键复制 编辑 原始数据 按行查看 历史
package memory
import (
"context"
"gitee.com/dennis-kk/service-box-go/util/config/source"
)
type (
memorySourceKey struct{}
)
//WithData will set binary data to source
func WithData(data []byte, format string) source.Option {
return func(option *source.Options) {
if option.Context == nil {
option.Context = context.Background()
}
cs := &source.ChangeSet{
Data: data,
Format: format,
}
option.Context = context.WithValue(option.Context, memorySourceKey{}, cs)
}
}
//WithYaml will set yaml file to source
func WithYaml(data []byte) source.Option {
return WithData(data, "yaml")
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dennis-kk/service-box-go.git
git@gitee.com:dennis-kk/service-box-go.git
dennis-kk
service-box-go
Service-Box-go
v0.4.16

搜索帮助