rowId property

Expression<int> rowId

In sqlite, each table that isn't virtual and hasn't been created with the WITHOUT ROWID modified has a row id. When the table has a single primary key column which is an integer, that column is an alias to the row id in sqlite3.

If the row id has not explicitly been declared as a column aliasing it, the rowId will not be part of a drift-generated data class. In this case, the rowId getter can be used to refer to a table's row id in a query.

Implementation

Expression<int> get rowId {
  if (withoutRowId || this is VirtualTableInfo) {
    throw ArgumentError('Cannot use rowId on a table without a rowid!');
  }

  return GeneratedColumn<int>('_rowid_', aliasedName, false,
      type: DriftSqlType.int);
}