Mock columnsWithAlias
raxod502-plaid opened this issue · 1 comments
raxod502-plaid commented
I would like a sqlmock instance to return column names with table aliases, the same way as the mysql driver does when enabling the columnsWithAlias
option documented here.
Proposal
The New
function takes a variadic list of options defined in options.go
, one could be added to return table aliases.
Use-cases
In order to join two tables that share a column name, it is necessary to use columnsWithAlias
in order to correctly identify columns in the returned records. Such code cannot be mocked by sqlmock without a similar feature.
raxod502-plaid commented
Invalid feature request. You can already do this by simply specifying the desired table alias as part of the column name when constructing the sqlmock.Rows
object to return.