2023-04-13 10:16:48 +02:00
|
|
|
package share
|
|
|
|
|
|
|
|
type FindResourcesOptionFunc func(*FindResourcesOptions)
|
|
|
|
|
|
|
|
type FindResourcesOptions struct {
|
|
|
|
Name *string
|
|
|
|
ValueType *ValueType
|
|
|
|
}
|
|
|
|
|
2023-09-13 06:03:25 +02:00
|
|
|
func NewFindResourcesOptions(funcs ...FindResourcesOptionFunc) *FindResourcesOptions {
|
2023-04-13 10:16:48 +02:00
|
|
|
opts := &FindResourcesOptions{}
|
|
|
|
|
|
|
|
for _, fn := range funcs {
|
|
|
|
fn(opts)
|
|
|
|
}
|
|
|
|
|
|
|
|
return opts
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithName(name string) FindResourcesOptionFunc {
|
|
|
|
return func(opts *FindResourcesOptions) {
|
|
|
|
opts.Name = &name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithType(valueType ValueType) FindResourcesOptionFunc {
|
|
|
|
return func(opts *FindResourcesOptions) {
|
|
|
|
opts.ValueType = &valueType
|
|
|
|
}
|
|
|
|
}
|