-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(supabase): define upsertMethod within query for supabase (#529)
- Loading branch information
Showing
8 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/brick_supabase/lib/src/supabase_provider_query.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'package:brick_core/core.dart'; | ||
import 'package:brick_supabase/src/supabase_provider.dart'; | ||
|
||
/// [SupabaseProvider]-specific options for a [Query] | ||
class SupabaseProviderQuery extends ProviderQuery<SupabaseProvider> { | ||
/// An internal definition for remote requests. | ||
/// In rare cases, a specific `update` or `insert` is preferable to `upsert`; | ||
/// this enum explicitly declares the desired behavior. | ||
final UpsertMethod? upsertMethod; | ||
|
||
/// [SupabaseProvider]-specific options for a [Query] | ||
const SupabaseProviderQuery({ | ||
this.upsertMethod, | ||
}); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => { | ||
if (upsertMethod != null) 'upsertMethod': upsertMethod?.name, | ||
}; | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is SupabaseProviderQuery && | ||
runtimeType == other.runtimeType && | ||
upsertMethod == other.upsertMethod; | ||
|
||
@override | ||
int get hashCode => upsertMethod.hashCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters