Add ability to change alias of all projections in the ProjectionList.

Add ability to exclude list of columns from ProjectionList.
This commit is contained in:
go-jet 2022-01-05 18:00:20 +01:00
parent 392ba63bc5
commit 5cbf4aac86
8 changed files with 377 additions and 31 deletions

View file

@ -13,7 +13,12 @@ func newAlias(expression Expression, aliasName string) Projection {
}
func (a *alias) fromImpl(subQuery SelectTable) Projection {
column := NewColumnImpl(a.alias, "", nil)
// if alias is in the form "table.column", we break it into two parts so that ProjectionList.As(newAlias) can
// overwrite tableName with a new alias. This method is called only for exporting aliased custom columns.
// Generated columns have default aliasing.
tableName, columnName := extractTableAndColumnName(a.alias)
column := NewColumnImpl(columnName, tableName, nil)
column.subQuery = subQuery
return &column