将查询参数添加到 Go Json Rest

Adding query Parameters to Go Json Rest

我正在使用图书馆 go-json-rest。我正在尝试识别代码中的查询参数,例如 localhost:8080/reminders?hello=world I want to access {hello: world} 。我有以下代码:

//in another function
&rest.Route{"GET", "/reminders", i.GetAllReminders},

func (i *Impl) GetAllReminders(w rest.ResponseWriter, r *rest.Request) {
    reminders := []Reminder{}
    i.DB.Find(&reminders)
    w.WriteJson(&reminders)
}

我知道 r.PathParams 包含 url 参数,但我似乎无法找到如何通过“?”查询参数。在 url.

鉴于 go-json-rest 是 net/http 之上的一个薄包装器,您是否查看过 that package's documentation? Specifically, the Request object 有一个字段 Form 包含已解析的查询字符串值和 POST 数据的映射,您可以将其作为 url.Values (map[string][]string) 访问,或者特别是从 FormValue.[=17= 中检索一个]