4 Star 5 Fork 4

Plato / Service-Box-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
options.go 834 Bytes
一键复制 编辑 原始数据 按行查看 历史
CloudGuan 提交于 2022-02-27 22:43 . update: add basic config module
package config
import (
"gitee.com/dennis-kk/service-box-go/util/config/loader"
"gitee.com/dennis-kk/service-box-go/util/config/reader"
"gitee.com/dennis-kk/service-box-go/util/config/source"
)
type Options struct {
Loader loader.Loader
Reader reader.Reader
//Source is cache of options
Source []source.Source
}
//Option is the decorators func of change options variable
type Option func(o *Options)
// WithLoader sets the loader for manager config
func WithLoader(l loader.Loader) Option {
return func(o *Options) {
o.Loader = l
}
}
// WithSource appends a source to list of sources
func WithSource(s source.Source) Option {
return func(o *Options) {
o.Source = append(o.Source, s)
}
}
// WithReader sets the config reader
func WithReader(r reader.Reader) Option {
return func(o *Options) {
o.Reader = r
}
}
马建仓 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.5.14

搜索帮助

344bd9b3 5694891 D2dac590 5694891