<p>What I'm trying to accomplish:</p>
<p><a href="http://www.mysite.com/api?firstname=John&lastname=Smith" rel="nofollow">http://www.mysite.com/api?firstname=John&lastname=Smith</a></p>
<p>In the code, I need to dynamically generate a sql query based on the referenced URL variables (some or none could be specified... so it needs to be adaptive). To prevent SQL-injection, I need to structure the query in a way where the values of variables are appended to the '...interface{}' parameter of the db.Query() function (in the standard library).</p>
<p>This seems like an easy thing to do, but it isn't. If I could somehow convert a []interface{} that would satisfy the '...interface{}' (with the slice containing a pointer to the string holding the value) of the db.Query() call... that would work; however, I don't think that's possible. Any 3rd-party import or other advice on how to get what I'm needing going?</p>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传