Programmatically build select expression

Given an input to a query such as

CREATE QUERY foo(Set columns_, STRING term) FOR GRAPH g {

Is it possible to create a select query from that uses the Set to build the query? EG something like:

SELECT s from mynode:n WHERE (FOREACH col IN columns_ DO n.col LIKE term END;);

but that works


There are a couple of answers here.

For WHERE clause and similar expressions, there is the evaluate function as documented here:

For a general ability to compose any function we have interpreted queries:

I’m not aware of a way to make this fully self-contained, i.e. it is only exposed via the REST endpoint, or as a literal in the GSQL shell. I don’t believe you can build an entire query within GSQL itself and apply it.


Are there any plans to support datetime for evaluate?

I’m not aware of explicit support being planned (but I have been wrong before), but the examples in the documentation shows how to do this (using datetime_to_epoch and epoch_to_datetime functions) so you an pass the values as integers.