如何按序提取出func (session *Session) QueryInterface(sqlOrArgs ...interface{})返回的字段名列表? #2009
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#2009
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
我目前的需求是把任意的mysql查询结果导出为csv文件(带字段名),期望达到的是,当用户在浏览器输入框输入任意sql语句时,将sql结果导出为csv供用户下载,例子如下
但现在用xorm好像不太好处理,因为engine.QueryInterface返回的结果格式是
[]map[string]interface{}
,而map是乱序的,这也导致了我无法按序提取出字段名我看了一下xorm库提供的接口,目前尚未找到较方便的做法来实现按序提取出字段名,请问可以提供支持吗?或者我怎么才能做到这点?
简要的来说,下方的[1].写法无法满足需求,期望的是[2].写法,怎么才能实现?
[1]. 现有的查询方式如下:
[2]. 期望的查询方式如下: