How do you namespace methods when your Queries instances get too big? #2118
Unanswered
preslavrachev
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When a
Queries
instance starts accruing a lot of methods, it becomes difficult to find the right one. Without some sort of a naming convention, it may easily turn into scrolling through all the methods every time.I was wondering what conventions people are using to mitigate this issue. Go's idiomatic way of handling this would be to compose
Queries
out of multiple smallerXXXQueries
instances - e.g.UserQueries
,OrderQueries
, etc. I know that this has been suggested in the past, but was not voted in favor of, so we are left to come up with a clever way of naming each method.In one of our projects, er ended up prefixing the methods with the name of the table/entity they deal with:
I am aware that this type of naming is not really Go-idiomatic, but it has helped us somewhat with the glanceability.
What other conventions have people come up with?
Beta Was this translation helpful? Give feedback.
All reactions