Add support for exporting a ColumnList from a subquery.

This commit is contained in:
go-jet 2025-03-13 12:45:01 +01:00
parent 13ad686ac4
commit 85ea908285
3 changed files with 124 additions and 7 deletions

View file

@ -51,6 +51,18 @@ func (cl ColumnList) As(tableAlias string) ProjectionList {
return ret
}
// From creates a new ColumnList that references the specified subquery.
// This method is typically used to project columns from a subquery into the surrounding query.
func (cl ColumnList) From(subQuery SelectTable) ColumnList {
var ret ColumnList
for _, column := range cl {
ret = append(ret, column.fromImpl(subQuery).(ColumnExpression))
}
return ret
}
func (cl ColumnList) fromImpl(subQuery SelectTable) Projection {
newProjectionList := ProjectionList{}