-
Notifications
You must be signed in to change notification settings - Fork 108
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
Remove table name from columns alias #263
Comments
Empty alias string means no alias. I don't see other way then alias each column manually: stmt := SELECT(Jet.ID.AS("id")).FROM(Jet) Although, far easier would be to just ditch sqlx. |
Well the problem is not sqlx per se the problem is the hundreds of model structs that are already in the codebase that expect column name aliases without the table name, either due to existing |
You can use jet with custom model types as well. Also those db aliases will be ignored by jet QRM. |
I have an older project where I would like to use Jet as a query generator. The project already contains models with db tags and binding via sqlx.
Jet by default generate queries with column aliases including table names, e.g. for a table called
jet
the codeprints
I would like to have a setting where the above stmt prints
SELECT jet.id AS "id" FROM jet;
by default.I know I can manually add aliases to the columns in the query but for porting an older project to Jet it gets tedious quickly.
This answer suggests creating an alias for the table but even defining a table alias with an empty string
aliasedTable := Jet.AS("")
does not remove the table name from the column alias.The text was updated successfully, but these errors were encountered: