-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new fieldas
tag to set AS name for SELECT
#79
Conversation
README.md
Outdated
@@ -136,6 +136,7 @@ type ATable struct { | |||
Field2 int `db:"field2"` // Use "db" in field tag to set column name used in SQL. | |||
Field3 int64 `db:"field3" fieldtag:"foo,bar"` // Set fieldtag to a field. We can use methods like `Struct#SelectForTag` to use it. | |||
Field4 int64 `db:"field4" fieldtag:"foo"` // If we use `s.SelectForTag(table, "foo")`, columnes of SELECT are field3 and field4. | |||
Field5As string `db:"field5" fieldas:"FIELD5"` // Use "fieldas" in field tag to set AS name used in SELECT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field5As string `db:"field5" fieldas:"FIELD5"` // Use "fieldas" in field tag to set AS name used in SELECT. | |
Field5As string `db:"field5" fieldas:"FIELD5"` // Use "fieldas" in field tag to set AS name used in SELECT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better description than "AS name" that we could use? Might help users searching for this feature in your library. I'm not sure if there is an official term, but I can see people using "alias" or "AS clause".
Could do something like:
// Use "fieldas" in field tag to set a column alias/clause (AS) used in SELECT.
Or:
// Use "fieldas" in field tag to set the returned column name (AS) using in SELECT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
See #78 for discussion about this feature.