Insert: sort column names #10
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?
Author: @fasterthanlime
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 👍 !
Author: @lunny
@fasterthanlime please send a PR! Thanks!