asNamed method

QueryPart asNamed(
  1. String name
)

Get QueryPart with custom name.

Usually used for simplifying query names.

For example:

personsProvider.query(queries:(p)=>[p.firstName.toLowerCase().asNamed('lname'),n.age])

This results db table as:

|lname|age|

|mohammed|15|

|ahmed|12|

Implementation

QueryPart asNamed(String name) {
  var result = QueryPart._();
  result.queryBuilder = () => '${buildQuery()} AS \'$name\'';
  result.parametersBuilder = () => getParameters();
  return result;
}