condition/engine/engine_option.go
2023-07-24 13:39:12 +08:00

31 lines
492 B
Go

package engine
type engineOptions struct {
debug bool
relations []string
}
type EngineOption interface {
apply(*engineOptions)
}
type fnOption struct {
f func(*engineOptions)
}
func (this fnOption) apply(do *engineOptions) {
this.f(do)
}
func Debug() EngineOption {
return &fnOption{f: func(o *engineOptions) {
o.debug = true
}}
}
func Relation(opts ...string) EngineOption {
return &fnOption{f: func(o *engineOptions) {
o.relations = append(o.relations, opts...)
}}
}