sqlSelect method

Future<List> sqlSelect(
  1. {String? where,
  2. String? orderBy,
  3. int? limit,
  4. int? offset,
  5. String? groupBy,
  6. bool verbose = false}
)

Select rows in the database table

Implementation

Future<List<dynamic>> sqlSelect(
    {String? where,
    String? orderBy,
    int? limit,
    int? offset,
    String? groupBy,
    bool verbose = false}) async {
  _checkDbIsReady();
  // do not take the foreign keys
  final cols = <String>["id"];
  for (final col in table!.columns) {
    if (!col.isForeignKey) {
      cols.add(col.name);
    }
  }
  final columns = cols.join(",");
  final res = await (db!.select(
      table: table!.name,
      columns: columns,
      where: where,
      orderBy: orderBy,
      limit: limit,
      offset: offset,
      groupBy: groupBy,
      verbose: verbose) as Future<List<Map<String, dynamic>>>);
  final endRes = <dynamic>[];
  for (final row in res) {
    endRes.add(fromDb(row));
  }
  return endRes;
}