Block syntax in order by removed from query API
In 9.0, the Gosu language no longer supports
block syntax as an argument to the query builder orderBy method. Gosu retains equivalent
functionality for ordering rows from the application database by using
a method that returns an object that implements the IQuerySelectColumn interface.
Configuration upgrade tools for Version 9.0 convert legacy arguments
for the query builder orderBy
method to equivalent query builder code.
For example, the query builder orderBy method in the following
example Gosu code from earlier versions of PolicyCenter returns Address instances that are ordered
by their postal code.
uses gw.api.database.Query
var select = Query.make(Address).select()
// Specify to sort the result by postal code.
select.orderBy(\ row -> row.PostalCode)
After upgrade, the preceding block is converted to the following query builder code, which also returns addresses that are ordered by their postal code.
uses gw.api.database.Query
uses gw.api.database.QuerySelectColumns
uses gw.api.path.Paths
var select = Query.make(Address).select()
// Specify to sort the result by postal code.
select.orderBy(QuerySelectColumns.path(Paths.make(Address#PostalCode)
See also
