MCPcopy Create free account
hub / github.com/rilldata/rill / WithQuery

Function WithQuery

admin/pkg/urlutil/urlutils.go:5–21  ·  view source on GitHub ↗
(urlString string, query map[string]string)

Source from the content-addressed store, hash-verified

3import "net/url"
4
5func WithQuery(urlString string, query map[string]string) (string, error) {
6 if len(query) == 0 {
7 return urlString, nil
8 }
9
10 parsedURL, err := url.Parse(urlString)
11 if err != nil {
12 return "", err
13 }
14
15 qry := parsedURL.Query()
16 for key, value := range query {
17 qry.Set(key, value)
18 }
19 parsedURL.RawQuery = qry.Encode()
20 return parsedURL.String(), nil
21}
22
23func MustWithQuery(urlString string, query map[string]string) string {
24 newURL, err := WithQuery(urlString, query)

Callers 5

logoutHandlerMethod · 0.92
OpenCmdFunction · 0.92
EmbedMethod · 0.92
handlePKCEMethod · 0.92
MustWithQueryFunction · 0.85

Calls 5

ParseMethod · 0.80
EncodeMethod · 0.80
QueryMethod · 0.65
StringMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected