Enable $this parameter in SELECT queries

It is now possible to select yielded output fields in the same query, without needing to use a subquery.
This commit is contained in:
Tobie Morgan Hitchcock 2018-05-31 14:34:39 +01:00
parent 7277e32d88
commit ba40fd7285

View file

@ -184,6 +184,14 @@ func (d *document) yield(ctx context.Context, stm sql.Statement, output sql.Toke
}
}
// Ensure that all output fields are
// available in subsequent expressions
// using the $this parameter.
vars := data.New()
vars.Set(out.Data(), varKeyThis)
ctx = context.WithValue(ctx, ctxKeySpec, vars)
// Next let's see the field expressions
// which have been requested, and add
// these to the output document.