doc.gno
0.77 Kb ยท 31 lines
1/*
2Package query provides a simple way to handle queries in your realm.
3
4It includes helper functions to extract individual query parameters, convert the full query string into a map,
5and update one or more parameters in a URL.
6
7Example:
8
9 import (
10 "gno.land/p/lou/query"
11 "gno.land/p/moul/md"
12 )
13
14 func Render(rawPath string) string {
15 mode, err := query.GetQueryValueFromURL("mode", rawPath)
16 if err != nil || mode == "" {
17 mode = "grid" // default value
18 }
19
20 // Handle queryMode value
21 listURL, _ := query.UpdateQueryValue(rawPath, "mode", "list")
22 gridURL, _ := query.UpdateQueryValue(rawPath, "mode", "grid")
23
24 out := md.Link("list mode", listURL) + "\n\n"
25 out += md.Link("grid mode", gridURL) + "\n\n"
26 return out
27 }
28
29*/
30
31package query // import "gno.land/p/lou/query"