mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
31 lines
546 B
Go
31 lines
546 B
Go
package options
|
|
|
|
type ParsePathSettings struct {
|
|
Resolve bool
|
|
}
|
|
|
|
type ParsePathOption func(*ParsePathSettings) error
|
|
|
|
func ParsePathOptions(opts ...ParsePathOption) (*ParsePathSettings, error) {
|
|
options := &ParsePathSettings{
|
|
Resolve: false,
|
|
}
|
|
|
|
for _, opt := range opts {
|
|
err := opt(options)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return options, nil
|
|
}
|
|
|
|
type ApiOptions struct{}
|
|
|
|
func (api *ApiOptions) WithResolve(r bool) ParsePathOption {
|
|
return func(settings *ParsePathSettings) error {
|
|
settings.Resolve = r
|
|
return nil
|
|
}
|
|
}
|