addColumns method

JoinedSelectStatement<HasResultSet, dynamic> addColumns(
  1. List<Expression<Object>> expressions
)

Adds a custom expression to the query.

The database will evaluate the Expression for each row found for this query. The value of the expression can be extracted from the TypedResult by passing it to TypedResult.read.

As an example, we could calculate the length of a column on the database:

final contentLength = todos.content.length;
final results = await select(todos).addColumns([contentLength]).get();

// we can now read the result of a column added to addColumns
final lengthOfFirst = results.first.read(contentLength);

See also:

Implementation

JoinedSelectStatement addColumns(List<Expression> expressions) {
  return join([])..addColumns(expressions);
}