我想将我的 SQL 查询与UNION ALLgolang http://golang.org/pkg/text/template/ 连接起来例如,我有:var slice1 = []string{"2014-01-01", "2014-01-02", "2014-01-03"}var slice2 = []string{"20140101", "20140102", "20140103"}并查询:select {{.date}} as date, itemid, pricefrom orderhistory_t{{datetag}}并使用模板创建如下查询:select '2014-01-01' as date, itemid, pricefrom orderhistory_t20140101union all select '2014-01-02' as date, itemid, pricefrom orderhistory_t20140102union all select '2014-01-03' as date, itemid, pricefrom orderhistory_t20140103如何遍历 Golang 的切片并将它们放入 sql 模板中?
1 回答
- 1 回答
- 0 关注
- 146 浏览
添加回答
举报
0/150
提交
取消