Skip to content

Commit

Permalink
refactor!: rename is_ and in_ to isFilter and inFilter (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Sep 28, 2023
1 parent 53cd3e0 commit 1227394
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/postgrest/lib/src/postgrest_filter_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
/// .is_('data', null);
/// ```
// ignore: non_constant_identifier_names
PostgrestFilterBuilder<T> is_(String column, Object? value) {
PostgrestFilterBuilder<T> isFilter(String column, Object? value) {
return copyWithUrl(appendSearchParams(column, 'is.$value'));
}

Expand All @@ -241,7 +241,7 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
/// .in_('status', ['ONLINE', 'OFFLINE']);
/// ```
// ignore: non_constant_identifier_names
PostgrestFilterBuilder<T> in_(String column, List values) {
PostgrestFilterBuilder<T> inFilter(String column, List values) {
return copyWithUrl(
appendSearchParams(column, 'in.(${_cleanFilterArray(values)})'));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/postgrest/lib/src/postgrest_query_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ part of 'postgrest_builder.dart';
/// * update() - "patch"
/// * delete() - "delete"
/// Once any of these are called the filters are passed down to the Request.
/// /// {@endtemplate}
/// {@endtemplate}
class PostgrestQueryBuilder<T> extends RawPostgrestBuilder<T, T, T> {
/// {@macro postgrest_query_builder}
PostgrestQueryBuilder({
Expand Down
2 changes: 1 addition & 1 deletion packages/postgrest/test/basic_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void main() {
.update(
{'channel_id': 2},
)
.is_("data", null)
.isFilter("data", null)
.select();
expect(res, isNotEmpty);
expect(res, everyElement(containsPair("channel_id", 2)));
Expand Down
7 changes: 4 additions & 3 deletions packages/postgrest/test/filter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ void main() {
});

test('is', () async {
final res = await postgrest.from('users').select('data').is_('data', null);
final res =
await postgrest.from('users').select('data').isFilter('data', null);
expect(res, isNotEmpty);
for (final item in res) {
expect(item['data'], null);
Expand All @@ -246,7 +247,7 @@ void main() {
final res = await postgrest
.from('users')
.select('status')
.in_('status', ['ONLINE', 'OFFLINE']);
.inFilter('status', ['ONLINE', 'OFFLINE']);
expect(res, isNotEmpty);
for (final item in res) {
expect(
Expand Down Expand Up @@ -429,7 +430,7 @@ void main() {
.from('users')
.select()
.eq('username', 'supabot')
.is_('data', null)
.isFilter('data', null)
.overlaps('age_range', '[1,2)')
.eq('status', 'ONLINE')
.textSearch('catchphrase', 'cat');
Expand Down
2 changes: 1 addition & 1 deletion packages/supabase/lib/src/supabase_stream_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class SupabaseStreamBuilder extends Stream<SupabaseStreamEvent> {
query = query.gte(_streamFilter!.column, _streamFilter!.value);
break;
case _FilterType.inFilter:
query = query.in_(_streamFilter!.column, _streamFilter!.value);
query = query.inFilter(_streamFilter!.column, _streamFilter!.value);
break;
}
}
Expand Down

0 comments on commit 1227394

Please sign in to comment.