...
Let’s look at this query which reads a single row with sku = “MB-00001” 0001” from the Product master table:
Code Block |
---|
def qqapi = api.queryApi() def t = qqapi.tables().products() return q.source(t, q.exprs().and( t.sku().equal("MB-0001"), )) .stream { it.collect { it } } |
...
Returns all fields from table t1
. No row filtering. Note that production code you should specify the fields in order to only return fields really used due to performance. So preferably use this:
Example:
Code Block |
---|
q.source(t1, [t1.sku(), t1.Brand]) |
...
Example:
Code Block |
---|
q.source(tt1, [t1.sku(), t1.Brand], q.exprs().and( tt1.sku().equal("MB-0001"), )) |
Returns sku
and Brand
fields from the table t1
and filters the rows to return row with sku = “MB-0001”.
...