bouncer/internal/rule/options.go
William Petit 05b547da48
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
Cadoles/bouncer/pipeline/pr-develop This commit looks good
feat: rewriter layer
2024-06-25 16:50:29 +02:00

36 lines
550 B
Go

package rule
import "github.com/expr-lang/expr"
type Options struct {
Rules []string
Expr []expr.Option
}
type OptionFunc func(opts *Options)
func NewOptions(funcs ...OptionFunc) *Options {
opts := &Options{
Expr: make([]expr.Option, 0),
Rules: make([]string, 0),
}
for _, fn := range funcs {
fn(opts)
}
return opts
}
func WithRules(rules ...string) OptionFunc {
return func(opts *Options) {
opts.Rules = rules
}
}
func WithExpr(options ...expr.Option) OptionFunc {
return func(opts *Options) {
opts.Expr = options
}
}