path.go 546 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
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
	}
}