<p>I have a query string like this /query?x=123&h=er&y=124.
I have no knowlegde of what the query string parameters are going to be.
So i don't know how many key values i'm going to receive nor the key names.
Buffalo has a Context Interface that will return those params for me. (Context.Params() )(<a href="https://gobuffalo.io/docs/context" rel="nofollow">https://gobuffalo.io/docs/context</a>)
But now, how do iterate those params?
The only thing i that worked was using reflect.ValueOf(map).MapKeys().
But it doesn't feel like this should be the right way of doing it.
Any feedback? How would you guys do it?
Thanks</p>
<hr/>**评论:**<br/><br/>peterbourgon: <pre><p>Wow, yeah, that's a problem. The ParamValues API or return type definitely needs to be updated: to return a <code>map[string][]string</code>, or provide some kind of <code>Walk</code> method, or something.</p></pre>metacasts: <pre><p>Hopefully this should answer the question: <a href="https://gobuffalo.io/docs/context#ranging-over-parameters" rel="nofollow">https://gobuffalo.io/docs/context#ranging-over-parameters</a></p></pre>seomisS: <pre><p>Gosh... metacasts you are right. that answers the question. My bad... i don't know how i missed it.
Thanks for your answer.
Thank you peterbourgon as well!</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传