simpleQueryData method

  1. @override
Future<List> simpleQueryData(
  1. String collectionId, {
  2. required String name,
  3. required String value,
  4. required String orderBy,
  5. bool descending = true,
  6. int? limit,
  7. int? offset,
})
override

Implementation

@override
Future<List> simpleQueryData(String collectionId,
    {required String name,
    required String value,
    required String orderBy,
    bool descending = true,
    int? limit,
    int? offset}) async {
  await initialize();

  SupabaseQueryBuilder fromRef = AbsDatabase.sbDBConn!.from(collectionId);
  if (limit != null) {
    if (offset != null) {
      return await fromRef
          .select()
          .eq(name, value)
          .order(orderBy, ascending: !descending)
          .limit(limit)
          .range(offset, offset + limit);
    }
    return await fromRef
        .select()
        .eq(name, value)
        .order(orderBy, ascending: !descending)
        .limit(limit);
  }
  return await fromRef.select().eq(name, value).order(orderBy, ascending: !descending);
}