delete<T> method

Future<T> delete<T>({
  1. required SupaFilter<B> filter,
  2. required SupaModifier<B, R, T, PostgrestBuilder, PostgrestBuilder> modifier,
  3. Set<SupaColumnBase<B>>? columns,
})

Deletes records from the Supabase table.

filter: The filter to apply to the query. This targets the records to delete.

columns: The set of columns to fetch. If null, all columns are fetched.

modifier: The modifier to apply to the query.

Implementation

Future<T> delete<T>({
  required SupaFilter<B> filter,
  required SupaModifier<B, R, T, PostgrestBuilder<dynamic, dynamic, dynamic>,
          PostgrestBuilder<dynamic, dynamic, dynamic>>
      modifier,
  Set<SupaColumnBase<B>>? columns,
}) async {
  final request = supabaseClient
      .schema(schema)
      .from(tableName)
      .delete()
      .supaApplyFilter(filter);

  if (modifier is! SupaNoneModifier<B, R>) {
    final response = await request
        .select(_generateColumnsPattern(columns))
        .supaApplyModifier(modifier);
    return _castResponse(modifier, response);
  }

  return (await request) as T;
}