select<Row extends Object, RS extends ResultSet<Row, RS>> method

SingleTableSelectStatement<Row, RS> select<Row extends Object, RS extends ResultSet<Row, RS>>(
  1. ResultSet<Row, RS> table, {
  2. bool distinct = false,
})

Starts a query on the given table.

In drift, queries are commonly used as a builder by chaining calls on them. For instance, to load the 10 oldest users with an 'S' in their name, you could use:

Future<List<User>> oldestUsers() {
  return select(users)
    .where((u) => u.name.like('%S%'))
    .orderBy([(u) => OrderingTerm(
        expression: u.id,
        mode: OrderingMode.asc
     )])
    .limit(10)
    .get();
}

The distinct parameter (defaults to false) can be used to remove duplicate rows from the result set.

For more information on queries, see the documentation.

Implementation

SingleTableSelectStatement<Row, RS> select<
  Row extends Object,
  RS extends ResultSet<Row, RS>
>(ResultSet<Row, RS> table, {bool distinct = false}) {
  return SingleTableSelectStatement<Row, RS>(this, table, distinct: distinct);
}