QueryString() return []map[string]string, which column order can not be the same as original #826

Open
opened 2018-01-14 14:07:23 +00:00 by shawnye · 4 comments
shawnye commented 2018-01-14 14:07:23 +00:00 (Migrated from github.com)

Map can not determine keys' order as Go announced, could you return map along with ordered field array ?

That means:

func (session *Session) QueryString(sqlorArgs ...interface{}) (data []map[string]string, fields []string, err error) {
...
}
`Map` can not determine keys' order as Go announced, could you return map along with `ordered field array` ? That means: <pre> func (session *Session) QueryString(sqlorArgs ...interface{}) (data []map[string]string, fields []string, err error) { ... } </pre>
shawnye commented 2018-01-14 14:08:33 +00:00 (Migrated from github.com)

Or there is any workaround?

Or there is any workaround?
Leadrive commented 2018-04-14 01:58:29 +00:00 (Migrated from github.com)

I read the field list from SQL string, and reset the result rows.
But now, I meet a issue, If the query record is zero, I can not get any field info.

I read the field list from SQL string, and reset the result rows. But now, I meet a issue, If the query record is zero, I can not get any field info.
lunny added this to the (deleted) milestone 2020-03-03 13:01:30 +00:00

xorm could support ReturnColumnNames(&slice), then after Get or Find, slice will be filled the column names slice string.

xorm could support `ReturnColumnNames(&slice)`, then after `Get` or `Find`, `slice` will be filled the column names slice string.
lunny modified the milestone from 1.3.0 to 1.3.0 2020-03-03 13:02:55 +00:00
lunny modified the milestone from 1.3.0 to 2.0.0 2021-10-19 13:43:56 +00:00

Or we can have QueryStringSlice which will return [][]struct{Key, Value string}.

Or we can have `QueryStringSlice` which will return `[][]struct{Key, Value string}`.
lunny unlocked this conversation 2023-07-26 04:56:12 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#826
No description provided.