Generate structs with x/tools fieldalignment suggested ordering #1281
Unanswered
natethinks
asked this question in
Ideas
Replies: 2 comments 1 reply
-
I think you'd want to trade this off with the readability of having e.g. the important fields in a database model listed first, or consecutively. In practice maybe it doesn't matter because the fields are not moving around that much. |
Beta Was this translation helpful? Give feedback.
1 reply
-
+1 it could save a good amount of memory, even if its just optional |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
x/tools
fieldalignment -fix
will reorder your structs to decrease memory usage and garbage collection. I propose thefieldallignment
order be used in the structs generated by sqlc. This can be run manually with no side effects as far as I can tell, but you'll have to run it again every time you generate the code.Beta Was this translation helpful? Give feedback.
All reactions