Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Passing null to not() filter is now allowed #775

Merged
merged 2 commits into from Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/postgrest/lib/src/postgrest_filter_builder.dart
Expand Up @@ -24,7 +24,7 @@ class PostgrestFilterBuilder<T> extends PostgrestTransformBuilder<T> {
/// .select()
/// .not('status', 'eq', 'OFFLINE');
/// ```
PostgrestFilterBuilder<T> not(String column, String operator, Object value) {
PostgrestFilterBuilder<T> not(String column, String operator, Object? value) {
final Uri url;
if (value is List) {
if (operator == "in") {
Expand Down
8 changes: 8 additions & 0 deletions packages/postgrest/test/filter_test.dart
Expand Up @@ -45,6 +45,14 @@ void main() {
}
});

test('not with is null', () async {
final res = await postgrest
.from('users')
.select('username')
.not('username', 'is', null);
expect(res.length, 4);
});

test('not with List of values', () async {
final res = await postgrest
.from('users')
Expand Down