1 Star 0 Fork 0

taadis / aikucun-sdk-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
options.go 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
taadis 提交于 2020-07-22 14:07 . update package
package aikucun
type Options struct {
Url string
AppId string
AppSecret string
Erp string
ErpVersion string
}
func NewOptions(options ...Option) Options {
opts := Options{
Url: "",
AppId: "",
AppSecret: "",
Erp: "",
ErpVersion: "",
}
for _, o := range options {
o(&opts)
}
return opts
}
type Option func(*Options)
// WithUrl set default url for the client
func WithUrl(url string) Option {
return func(options *Options) {
options.Url = url
}
}
// WithAppId set default url for the client
func WithAppId(appId string) Option {
return func(options *Options) {
options.AppId = appId
}
}
// WithAppSecret set default url for the client
func WithAppSecret(appSecret string) Option {
return func(options *Options) {
options.AppSecret = appSecret
}
}
// WithErp set default erp for the client
func WithErp(erp string) Option {
return func(options *Options) {
options.Erp = erp
}
}
// WithErpVersion set default erpVersion for the client
func WithErpVersion(erpVersion string) Option {
return func(options *Options) {
options.ErpVersion = erpVersion
}
}
Go
1
https://gitee.com/taadis/aikucun-sdk-go.git
git@gitee.com:taadis/aikucun-sdk-go.git
taadis
aikucun-sdk-go
aikucun-sdk-go
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891