31 lines
594 B
Go
31 lines
594 B
Go
|
package share
|
||
|
|
||
|
type FindResourcesOptionFunc func(*FindResourcesOptions)
|
||
|
|
||
|
type FindResourcesOptions struct {
|
||
|
Name *string
|
||
|
ValueType *ValueType
|
||
|
}
|
||
|
|
||
|
func FillFindResourcesOptions(funcs ...FindResourcesOptionFunc) *FindResourcesOptions {
|
||
|
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
|
||
|
}
|
||
|
}
|