You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.
These insert statements are generated with go-xorm/builder:
[37.61µs] INSERT INTO honors (title,id) Values (?,?) [Best Picture 0]
[37.67µs] INSERT INTO honors (id,title) Values (?,?) [1 Best Supporting Actor]
[11.215µs] INSERT INTO honors (id,title) Values (?,?) [2 Best Muffins]
[8.328µs] INSERT INTO honors (id,title) Values (?,?) [3 Second Best Muffins]
As you can see, sometimes it generates (title, id), and sometimes it generates (id, title). This is problematic in my usecase, all statements are prepared (and cached by their SQL string).
The reason this happens is because builder.Insert takes a builder.Eq, which is a golang map, and map iteration order in golang is random (by design).
A possible solution would be to sort the keys, so we get consistent ordering (at a slight performance cost).
Would you be open to this change? I'll happily open a PR once I get your 👍 !
The text was updated successfully, but these errors were encountered:
These insert statements are generated with go-xorm/builder:
As you can see, sometimes it generates
(title, id)
, and sometimes it generates(id, title)
. This is problematic in my usecase, all statements are prepared (and cached by their SQL string).The reason this happens is because
builder.Insert
takes abuilder.Eq
, which is a golang map, and map iteration order in golang is random (by design).A possible solution would be to sort the keys, so we get consistent ordering (at a slight performance cost).
Would you be open to this change? I'll happily open a PR once I get your 👍 !
The text was updated successfully, but these errors were encountered: