Improvements on sub-query projection reference.

This commit is contained in:
go-jet 2019-06-18 14:35:32 +02:00
parent d9ffa86453
commit 565b670188
17 changed files with 512 additions and 134 deletions

View file

@ -6,19 +6,29 @@ type ExpressionTable interface {
ReadableTable
Alias() string
AllColumns() ProjectionList
}
type expressionTableImpl struct {
readableTableInterfaceImpl
expression Expression
alias string
projections []projection
}
func newExpressionTable(expression Expression, alias string) ExpressionTable {
func newExpressionTable(expression Expression, alias string, projections []projection) ExpressionTable {
expTable := &expressionTableImpl{expression: expression, alias: alias}
expTable.readableTableInterfaceImpl.parent = expTable
for _, projection := range projections {
newProjection := projection.from(expTable)
expTable.projections = append(expTable.projections, newProjection)
}
return expTable
}
@ -26,6 +36,14 @@ func (e *expressionTableImpl) Alias() string {
return e.alias
}
func (e *expressionTableImpl) columns() []Column {
return nil
}
func (e *expressionTableImpl) AllColumns() ProjectionList {
return e.projections
}
func (e *expressionTableImpl) serialize(statement statementType, out *queryData, options ...serializeOption) error {
if e == nil {
return errors.New("Expression table is nil. ")