select method

  1. @override
Future<DbResult> select(
  1. String table, {
  2. Map<String, dynamic>? where,
  3. int? limit,
  4. int? offset,
})
override

Implementation

@override
Future<DbResult> select(
  String table, {
  Map<String, dynamic>? where,
  int? limit,
  int? offset,
}) async {
  var query = 'SELECT * FROM $table';
  final values = <String, dynamic>{};

  if (where != null && where.isNotEmpty) {
    final conditions = where.entries
        .map((e) => '${e.key} = @${e.key}')
        .join(' AND ');
    query += ' WHERE $conditions';
    values.addAll(where);
  }

  if (limit != null) query += ' LIMIT $limit';
  if (offset != null) query += ' OFFSET $offset';

  return rawQuery(query, values: values);
}