-
Notifications
You must be signed in to change notification settings - Fork 2
/
gen_options_optiongen.go
511 lines (463 loc) · 20.4 KB
/
gen_options_optiongen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
// Code generated by optiongen. DO NOT EDIT.
// optiongen: github.com/timestee/optiongen
package xconf
import (
"flag"
"io"
"log"
"os"
"runtime"
"strconv"
"sync/atomic"
"unsafe"
"github.com/sandwich-go/xconf/xutil"
)
// Options should use NewOptions to initialize it
type Options struct {
OptionUsage string `xconf:"option_usage"`
// annotation@NewFunc(comment="Parse时会由指定的File中加载配置")
Files []string `xconf:"files"`
// annotation@Readers(comment="Parse时会由指定的Reader中加载配置")
Readers []io.Reader `xconf:"readers" usage:"Parse时会由指定的Reader中加载配置"`
// annotation@FlagSet(comment="Parse使用的FlagSet,xconf会自动在flag中创建字段定义,如指定为空则不会创建")
FlagSet *flag.FlagSet `xconf:"flag_set" usage:"Parse使用的FlagSet,xconf会自动在flag中创建字段定义,如指定为空则不会创建"`
// annotation@FlagArgs(comment="FlagSet解析使用的Args列表,默认为os.Args[1:],如指定为空则不会触发FlagSet的定义和解析逻辑")
FlagArgs []string `xconf:"flag_args" usage:"FlagSet解析使用的Args列表,默认为os.Args[1:],如指定为空则不会触发FlagSet的定义和解析逻辑"`
// annotation@Environ(comment="Parse解析的环境变量,默认os.Environ(),内部转换为FlagSet处理,可通过--help获取当前支持的FlagSet与Env参数定义")
Environ []string `xconf:"environ" usage:"Parse解析的环境变量,默认os.Environ(),内部转换为FlagSet处理,可通过--help获取当前支持的FlagSet与Env参数定义"`
// annotation@ErrorHandling(comment="错误处理模式")
ErrorHandling ErrorHandling `xconf:"error_handling" usage:"错误处理模式"`
// annotation@TagName(comment="xconf使用的字段TAG名称,默认:xconf")
TagName string `xconf:"tag_name" usage:"xconf使用的字段TAG名称,默认:xconf"`
// annotation@DecoderConfigOption(comment="xconf内部依赖mapstructure,改方法用户用户层自定义mapstructure解析参数,参考:https://github.com/sandwich-go/mapstructure")
DecoderConfigOption []DecoderConfigOption `xconf:"decoder_config_option" usage:"xconf内部依赖mapstructure,改方法用户用户层自定义mapstructure解析参数,参考:https://github.com/sandwich-go/mapstructure"`
// annotation@MapMerge(comment="map是否开启merge模式,详情见文档")
MapMerge bool `xconf:"map_merge" usage:"map是否开启merge模式,详情见文档"`
// annotation@FieldTagConvertor(comment="字段名转换到FiledPath时优先使用TagName指定的名称,否则使用该函数转换")
FieldTagConvertor FieldTagConvertor `xconf:"field_tag_convertor" usage:"字段名转换到FiledPath时优先使用TagName指定的名称,否则使用该函数转换"`
// annotation@FieldPathRemoved(comment="弃用的配置,目标结构中已经删除,但配置文件中可能存在,解析时不会认为是错误,会将该配置丢弃,并打印WARNING日志")
FieldPathRemoved []string `xconf:"field_path_removed" usage:"弃用的配置,目标结构中已经删除,但配置文件中可能存在,解析时不会认为是错误,会将该配置丢弃,并打印WARNING日志"`
// annotation@Debug(comment="debug模式下输出调试信息")
Debug bool `xconf:"debug" usage:"debug模式下输出调试信息"`
// annotation@LogDebug(comment="DEBUG日志")
LogDebug LogFunc `xconf:"log_debug" usage:"DEBUG日志"`
// annotation@LogWarning(comment="WARNING日志")
LogWarning LogFunc `xconf:"log_warning" usage:"WARNING日志"`
// annotation@AppLabelList(comment="应用层Label,用于灰度发布场景")
AppLabelList []string `xconf:"app_label_list" usage:"应用层Label,用于灰度发布场景"`
// annotation@EnvBindShouldErrorWhenFailed(comment="EnvBind时如果Env中不存在指定的key而且没有指定默认值时是否返回错误")
EnvBindShouldErrorWhenFailed bool `xconf:"env_bind_should_error_when_failed" usage:"EnvBind时如果Env中不存在指定的key而且没有指定默认值时是否返回错误"`
// annotation@FlagCreateIgnoreFiledPath(comment="不创建到FlagSet中的字段FieldPath")
// todo: 可以通过tag中指定flagoff规避这个字段的支持
FlagCreateIgnoreFiledPath []string `xconf:"flag_create_ignore_filed_path" usage:"不创建到FlagSet中的字段FieldPath"`
// annotation@ParseDefault(comment="是否解析struct标签中的default数据,解析规则参考xflag支持")
ParseDefault bool `xconf:"parse_default" usage:"是否解析struct标签中的default数据,解析规则参考xflag支持"`
// annotation@TagNameForDefaultValue(comment="默认值TAG名称,默认default")
TagNameForDefaultValue string `xconf:"tag_name_for_default_value" usage:"默认值TAG名称,默认default"`
// annotation@ReplaceFlagSetUsage(comment="是否替换FlagSet的Usage,使用xconf内置版本")
ReplaceFlagSetUsage bool `xconf:"replace_flag_set_usage" usage:"是否替换FlagSet的Usage,使用xconf内置版本"`
// annotation@ParseMetaKeyFlagFiles(comment="是否解析flag中的MetaKeyFlagFiles指定的文件")
// 当一个app中有多个根配置,只能有一个根配置解析flag中的配置文件
ParseMetaKeyFlagFiles bool `xconf:"parse_meta_key_flag_files" usage:"是否解析flag中的MetaKeyFlagFiles指定的文件"`
// annotation@EnvironPrefix(comment="绑定ENV前缀,防止ENV名称覆盖污染")
EnvironPrefix string `xconf:"environ_prefix" usage:"绑定ENV前缀,防止ENV名称覆盖污染"`
// annotation@OptionUsagePoweredBy(comment="--help中显示Power by")
OptionUsagePoweredBy string `xconf:"option_usage_powered_by" usage:"--help中显示Power by"`
// annotation@ErrorUnused(comment="当配置中出现未用到的字段时是否认为是错误")
ErrorUnused bool `xconf:"error_unused" usage:"当配置中出现未用到的字段时是否认为是错误"`
// annotation@StringAlias(comment="值别名")
StringAlias map[string]string `xconf:"string_alias" usage:"值别名"`
// annotation@StringAliasFunc(comment="值别名计算逻辑")
StringAliasFunc map[string]func(s string) string `xconf:"string_alias_func" usage:"值别名计算逻辑"`
}
// NewOptions new Options
func NewOptions(opts ...Option) *Options {
cc := newDefaultOptions()
for _, opt := range opts {
opt(cc)
}
if watchDogOptions != nil {
watchDogOptions(cc)
}
return cc
}
// ApplyOption apply multiple new option and return the old ones
// sample:
// old := cc.ApplyOption(WithTimeout(time.Second))
// defer cc.ApplyOption(old...)
func (cc *Options) ApplyOption(opts ...Option) []Option {
var previous []Option
for _, opt := range opts {
previous = append(previous, opt(cc))
}
return previous
}
// Option option func
type Option func(cc *Options) Option
// WithOptionUsage option func for filed OptionUsage
func WithOptionUsage(v string) Option {
return func(cc *Options) Option {
previous := cc.OptionUsage
cc.OptionUsage = v
return WithOptionUsage(previous)
}
}
// WithFiles option func for filed Files
func WithFiles(v ...string) Option {
return func(cc *Options) Option {
previous := cc.Files
cc.Files = v
return WithFiles(previous...)
}
}
// WithReaders Parse时会由指定的Reader中加载配置
func WithReaders(v ...io.Reader) Option {
return func(cc *Options) Option {
previous := cc.Readers
cc.Readers = v
return WithReaders(previous...)
}
}
// WithFlagSet Parse使用的FlagSet,xconf会自动在flag中创建字段定义,如指定为空则不会创建
func WithFlagSet(v *flag.FlagSet) Option {
return func(cc *Options) Option {
previous := cc.FlagSet
cc.FlagSet = v
return WithFlagSet(previous)
}
}
// WithFlagArgs FlagSet解析使用的Args列表,默认为os.Args[1:],如指定为空则不会触发FlagSet的定义和解析逻辑
func WithFlagArgs(v ...string) Option {
return func(cc *Options) Option {
previous := cc.FlagArgs
cc.FlagArgs = v
return WithFlagArgs(previous...)
}
}
// WithEnviron Parse解析的环境变量,默认os.Environ(),内部转换为FlagSet处理,可通过--help获取当前支持的FlagSet与Env参数定义
func WithEnviron(v ...string) Option {
return func(cc *Options) Option {
previous := cc.Environ
cc.Environ = v
return WithEnviron(previous...)
}
}
// WithErrorHandling 错误处理模式
func WithErrorHandling(v ErrorHandling) Option {
return func(cc *Options) Option {
previous := cc.ErrorHandling
cc.ErrorHandling = v
return WithErrorHandling(previous)
}
}
// WithTagName xconf使用的字段TAG名称,默认:xconf
func WithTagName(v string) Option {
return func(cc *Options) Option {
previous := cc.TagName
cc.TagName = v
return WithTagName(previous)
}
}
// WithDecoderConfigOption xconf内部依赖mapstructure,改方法用户用户层自定义mapstructure解析参数,参考:https://github.com/sandwich-go/mapstructure
func WithDecoderConfigOption(v ...DecoderConfigOption) Option {
return func(cc *Options) Option {
previous := cc.DecoderConfigOption
cc.DecoderConfigOption = v
return WithDecoderConfigOption(previous...)
}
}
// WithMapMerge map是否开启merge模式,详情见文档
func WithMapMerge(v bool) Option {
return func(cc *Options) Option {
previous := cc.MapMerge
cc.MapMerge = v
return WithMapMerge(previous)
}
}
// WithFieldTagConvertor 字段名转换到FiledPath时优先使用TagName指定的名称,否则使用该函数转换
func WithFieldTagConvertor(v FieldTagConvertor) Option {
return func(cc *Options) Option {
previous := cc.FieldTagConvertor
cc.FieldTagConvertor = v
return WithFieldTagConvertor(previous)
}
}
// WithFieldPathRemoved 弃用的配置,目标结构中已经删除,但配置文件中可能存在,解析时不会认为是错误,会将该配置丢弃,并打印WARNING日志
func WithFieldPathRemoved(v ...string) Option {
return func(cc *Options) Option {
previous := cc.FieldPathRemoved
cc.FieldPathRemoved = v
return WithFieldPathRemoved(previous...)
}
}
// WithDebug debug模式下输出调试信息
func WithDebug(v bool) Option {
return func(cc *Options) Option {
previous := cc.Debug
cc.Debug = v
return WithDebug(previous)
}
}
// WithLogDebug DEBUG日志
func WithLogDebug(v LogFunc) Option {
return func(cc *Options) Option {
previous := cc.LogDebug
cc.LogDebug = v
return WithLogDebug(previous)
}
}
// WithLogWarning WARNING日志
func WithLogWarning(v LogFunc) Option {
return func(cc *Options) Option {
previous := cc.LogWarning
cc.LogWarning = v
return WithLogWarning(previous)
}
}
// WithAppLabelList 应用层Label,用于灰度发布场景
func WithAppLabelList(v ...string) Option {
return func(cc *Options) Option {
previous := cc.AppLabelList
cc.AppLabelList = v
return WithAppLabelList(previous...)
}
}
// WithEnvBindShouldErrorWhenFailed EnvBind时如果Env中不存在指定的key而且没有指定默认值时是否返回错误
func WithEnvBindShouldErrorWhenFailed(v bool) Option {
return func(cc *Options) Option {
previous := cc.EnvBindShouldErrorWhenFailed
cc.EnvBindShouldErrorWhenFailed = v
return WithEnvBindShouldErrorWhenFailed(previous)
}
}
// WithFlagCreateIgnoreFiledPath 不创建到FlagSet中的字段FieldPath
func WithFlagCreateIgnoreFiledPath(v ...string) Option {
return func(cc *Options) Option {
previous := cc.FlagCreateIgnoreFiledPath
cc.FlagCreateIgnoreFiledPath = v
return WithFlagCreateIgnoreFiledPath(previous...)
}
}
// WithParseDefault 是否解析struct标签中的default数据,解析规则参考xflag支持
func WithParseDefault(v bool) Option {
return func(cc *Options) Option {
previous := cc.ParseDefault
cc.ParseDefault = v
return WithParseDefault(previous)
}
}
// WithTagNameForDefaultValue 默认值TAG名称,默认default
func WithTagNameForDefaultValue(v string) Option {
return func(cc *Options) Option {
previous := cc.TagNameForDefaultValue
cc.TagNameForDefaultValue = v
return WithTagNameForDefaultValue(previous)
}
}
// WithReplaceFlagSetUsage 是否替换FlagSet的Usage,使用xconf内置版本
func WithReplaceFlagSetUsage(v bool) Option {
return func(cc *Options) Option {
previous := cc.ReplaceFlagSetUsage
cc.ReplaceFlagSetUsage = v
return WithReplaceFlagSetUsage(previous)
}
}
// WithParseMetaKeyFlagFiles 是否解析flag中的MetaKeyFlagFiles指定的文件
func WithParseMetaKeyFlagFiles(v bool) Option {
return func(cc *Options) Option {
previous := cc.ParseMetaKeyFlagFiles
cc.ParseMetaKeyFlagFiles = v
return WithParseMetaKeyFlagFiles(previous)
}
}
// WithEnvironPrefix 绑定ENV前缀,防止ENV名称覆盖污染
func WithEnvironPrefix(v string) Option {
return func(cc *Options) Option {
previous := cc.EnvironPrefix
cc.EnvironPrefix = v
return WithEnvironPrefix(previous)
}
}
// WithOptionUsagePoweredBy --help中显示Power by
func WithOptionUsagePoweredBy(v string) Option {
return func(cc *Options) Option {
previous := cc.OptionUsagePoweredBy
cc.OptionUsagePoweredBy = v
return WithOptionUsagePoweredBy(previous)
}
}
// WithErrorUnused 当配置中出现未用到的字段时是否认为是错误
func WithErrorUnused(v bool) Option {
return func(cc *Options) Option {
previous := cc.ErrorUnused
cc.ErrorUnused = v
return WithErrorUnused(previous)
}
}
// WithStringAlias 值别名
func WithStringAlias(v map[string]string) Option {
return func(cc *Options) Option {
previous := cc.StringAlias
cc.StringAlias = v
return WithStringAlias(previous)
}
}
// WithStringAliasFunc 值别名计算逻辑
func WithStringAliasFunc(v map[string]func(s string) string) Option {
return func(cc *Options) Option {
previous := cc.StringAliasFunc
cc.StringAliasFunc = v
return WithStringAliasFunc(previous)
}
}
// InstallOptionsWatchDog the installed func will called when NewOptions called
func InstallOptionsWatchDog(dog func(cc *Options)) { watchDogOptions = dog }
// watchDogOptions global watch dog
var watchDogOptions func(cc *Options)
// newDefaultOptions new default Options
func newDefaultOptions() *Options {
cc := &Options{}
for _, opt := range [...]Option{
WithOptionUsage(optionUsage),
WithFiles([]string{}...),
WithReaders([]io.Reader{}...),
WithFlagSet(flag.CommandLine),
WithFlagArgs(os.Args[1:]...),
WithEnviron(os.Environ()...),
WithErrorHandling(PanicOnError),
WithTagName(DefaultTagName),
WithDecoderConfigOption(nil...),
WithMapMerge(false),
WithFieldTagConvertor(xutil.SnakeCase),
WithFieldPathRemoved(make([]string, 0)...),
WithDebug(false),
WithLogDebug(func(s string) { log.Println("[ DEBUG] " + s) }),
WithLogWarning(func(s string) { log.Println("[WARNING] " + s) }),
WithAppLabelList([]string{}...),
WithEnvBindShouldErrorWhenFailed(true),
WithFlagCreateIgnoreFiledPath(make([]string, 0)...),
WithParseDefault(true),
WithTagNameForDefaultValue(DefaultValueTagName),
WithReplaceFlagSetUsage(true),
WithParseMetaKeyFlagFiles(true),
WithEnvironPrefix(""),
WithOptionUsagePoweredBy(powerBy),
WithErrorUnused(true),
WithStringAlias(map[string]string{
"math.MaxInt": strconv.Itoa(maxInt),
"math.MaxInt8": strconv.Itoa(maxInt8),
"math.MaxInt16": strconv.Itoa(maxInt16),
"math.MaxInt32": strconv.Itoa(maxInt32),
"math.MaxInt64": strconv.FormatInt(maxInt64, 10),
"math.MaxUint": strconv.FormatUint(maxUint, 10),
"math.MaxUint8": strconv.FormatUint(maxUint8, 10),
"math.MaxUint16": strconv.FormatUint(maxUint16, 10),
"math.MaxUint32": strconv.FormatUint(maxUint32, 10),
"math.MaxUint64": strconv.FormatUint(maxUint64, 10),
}),
WithStringAliasFunc(map[string]func(s string) string{
"runtime.NumCPU": func(s string) string {
return strconv.Itoa(runtime.NumCPU())
},
}),
} {
opt(cc)
}
return cc
}
// AtomicSetFunc used for XConf
func (cc *Options) AtomicSetFunc() func(interface{}) { return AtomicOptionsSet }
// atomicOptions global *Options holder
var atomicOptions unsafe.Pointer
// onAtomicOptionsSet global call back when AtomicOptionsSet called by XConf.
// use OptionsInterface.ApplyOption to modify the updated cc
// if passed in cc not valid, then return false, cc will not set to atomicOptions
var onAtomicOptionsSet func(cc OptionsInterface) bool
// InstallCallbackOnAtomicOptionsSet install callback
func InstallCallbackOnAtomicOptionsSet(callback func(cc OptionsInterface) bool) {
onAtomicOptionsSet = callback
}
// AtomicOptionsSet atomic setter for *Options
func AtomicOptionsSet(update interface{}) {
cc := update.(*Options)
if onAtomicOptionsSet != nil && !onAtomicOptionsSet(cc) {
return
}
atomic.StorePointer(&atomicOptions, (unsafe.Pointer)(cc))
}
// AtomicOptions return atomic *OptionsVisitor
func AtomicOptions() OptionsVisitor {
current := (*Options)(atomic.LoadPointer(&atomicOptions))
if current == nil {
defaultOne := newDefaultOptions()
if watchDogOptions != nil {
watchDogOptions(defaultOne)
}
atomic.CompareAndSwapPointer(&atomicOptions, nil, (unsafe.Pointer)(defaultOne))
return (*Options)(atomic.LoadPointer(&atomicOptions))
}
return current
}
// all getter func
func (cc *Options) GetOptionUsage() string { return cc.OptionUsage }
func (cc *Options) GetFiles() []string { return cc.Files }
func (cc *Options) GetReaders() []io.Reader { return cc.Readers }
func (cc *Options) GetFlagSet() *flag.FlagSet { return cc.FlagSet }
func (cc *Options) GetFlagArgs() []string { return cc.FlagArgs }
func (cc *Options) GetEnviron() []string { return cc.Environ }
func (cc *Options) GetErrorHandling() ErrorHandling { return cc.ErrorHandling }
func (cc *Options) GetTagName() string { return cc.TagName }
func (cc *Options) GetDecoderConfigOption() []DecoderConfigOption { return cc.DecoderConfigOption }
func (cc *Options) GetMapMerge() bool { return cc.MapMerge }
func (cc *Options) GetFieldTagConvertor() FieldTagConvertor { return cc.FieldTagConvertor }
func (cc *Options) GetFieldPathRemoved() []string { return cc.FieldPathRemoved }
func (cc *Options) GetDebug() bool { return cc.Debug }
func (cc *Options) GetLogDebug() LogFunc { return cc.LogDebug }
func (cc *Options) GetLogWarning() LogFunc { return cc.LogWarning }
func (cc *Options) GetAppLabelList() []string { return cc.AppLabelList }
func (cc *Options) GetEnvBindShouldErrorWhenFailed() bool { return cc.EnvBindShouldErrorWhenFailed }
func (cc *Options) GetFlagCreateIgnoreFiledPath() []string { return cc.FlagCreateIgnoreFiledPath }
func (cc *Options) GetParseDefault() bool { return cc.ParseDefault }
func (cc *Options) GetTagNameForDefaultValue() string { return cc.TagNameForDefaultValue }
func (cc *Options) GetReplaceFlagSetUsage() bool { return cc.ReplaceFlagSetUsage }
func (cc *Options) GetParseMetaKeyFlagFiles() bool { return cc.ParseMetaKeyFlagFiles }
func (cc *Options) GetEnvironPrefix() string { return cc.EnvironPrefix }
func (cc *Options) GetOptionUsagePoweredBy() string { return cc.OptionUsagePoweredBy }
func (cc *Options) GetErrorUnused() bool { return cc.ErrorUnused }
func (cc *Options) GetStringAlias() map[string]string { return cc.StringAlias }
func (cc *Options) GetStringAliasFunc() map[string]func(s string) string { return cc.StringAliasFunc }
// OptionsVisitor visitor interface for Options
type OptionsVisitor interface {
GetOptionUsage() string
GetFiles() []string
GetReaders() []io.Reader
GetFlagSet() *flag.FlagSet
GetFlagArgs() []string
GetEnviron() []string
GetErrorHandling() ErrorHandling
GetTagName() string
GetDecoderConfigOption() []DecoderConfigOption
GetMapMerge() bool
GetFieldTagConvertor() FieldTagConvertor
GetFieldPathRemoved() []string
GetDebug() bool
GetLogDebug() LogFunc
GetLogWarning() LogFunc
GetAppLabelList() []string
GetEnvBindShouldErrorWhenFailed() bool
GetFlagCreateIgnoreFiledPath() []string
GetParseDefault() bool
GetTagNameForDefaultValue() string
GetReplaceFlagSetUsage() bool
GetParseMetaKeyFlagFiles() bool
GetEnvironPrefix() string
GetOptionUsagePoweredBy() string
GetErrorUnused() bool
GetStringAlias() map[string]string
GetStringAliasFunc() map[string]func(s string) string
}
// OptionsInterface visitor + ApplyOption interface for Options
type OptionsInterface interface {
OptionsVisitor
ApplyOption(...Option) []Option
}