Documentation ¶
Index ¶
- func File(p string) string
- func Join(b string, c ...interface{}) string
- func MergeParams(s string, p url.Values, opts ...MergeOption) (string, error)
- func MergeQuery(s string, p ...url.Values) (string, error)
- func MergeValues(a, b url.Values, opts ...MergeOption) url.Values
- func ParseValueList(v []string, d string) []string
- type MergeConfig
- type MergeOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Join ¶
Join a base URL together with path components, similar to the functionality of path.Join.
func MergeParams ¶ added in v1.31.0
Merge the specified queury parameters into the provided URL. This version accepts a set of options which control how the merge is performed. By default, parameters with existing keys are replaced, not added.
func MergeQuery ¶
Merge the specified queury parameters into the provided URL. Parameters with existing keys are added, not replaced. This function is depreacated and MergeParams() or MergeValues() should be preferred.
func MergeValues ¶ added in v1.31.0
func MergeValues(a, b url.Values, opts ...MergeOption) url.Values
Merge the specified values. Either one of the parameters or a new set of values is returned.
func ParseValueList ¶
Parse parameters from the provided Values and produce a list of results for the specified key. Both values defined by repeatedly providing a key and those provided in a delimited list for a single key are returned.
For example, using the delimiter ',':
a=one&a=two -> [one, two] a=one,two -> [one, two] a=one,two&a=three -> [one, two, three]
Use this method like so:
ParseValueList(vals["name"], ",")
Types ¶
type MergeConfig ¶ added in v1.31.0
type MergeConfig struct {
Append bool
}
func (MergeConfig) WithOptions ¶ added in v1.31.0
func (c MergeConfig) WithOptions(opts []MergeOption) MergeConfig
type MergeOption ¶ added in v1.31.0
type MergeOption func(MergeConfig) MergeConfig
func Append ¶ added in v1.31.0
func Append(b bool) MergeOption