mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 14:49:10 +03:00
fix(docs): correct code examples for dart ref
This commit is contained in:
1 parent
83d46e9284
commit
7b00aed6e0
1 file changed
+43
-10
+43
-10
@@ -504,7 +504,7 @@ functions:
|
||||
isSpotlight: true
|
||||
code: |
|
||||
```dart
|
||||
final data = await supabase
|
||||
await supabase
|
||||
.from('cities')
|
||||
.insert({'name': 'The Shire', 'country_id': 554});
|
||||
```
|
||||
@@ -512,10 +512,21 @@ functions:
|
||||
name: Bulk create
|
||||
code: |
|
||||
```dart
|
||||
final res = await supabase.from('cities').insert([
|
||||
final List<Map<String, dynamic>> data =
|
||||
await supabase.from('cities').insert([
|
||||
{'name': 'The Shire', 'country_id': 554},
|
||||
{'name': 'Rohan', 'country_id': 555},
|
||||
]);
|
||||
]).select();
|
||||
```
|
||||
- id: fetch-inserted-data
|
||||
name: Fetch inserted record
|
||||
code: |
|
||||
```dart
|
||||
final List<Map<String, dynamic>> data =
|
||||
await supabase.from('cities').insert([
|
||||
{'name': 'The Shire', 'country_id': 554},
|
||||
{'name': 'Rohan', 'country_id': 555},
|
||||
]).select();
|
||||
```
|
||||
|
||||
- id: update
|
||||
@@ -526,17 +537,17 @@ functions:
|
||||
- `update()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to update.
|
||||
examples:
|
||||
- id: updating-your-data
|
||||
name: Updating your data
|
||||
name: Update your data
|
||||
isSpotlight: true
|
||||
code: |
|
||||
```dart
|
||||
final data = await supabase
|
||||
await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Middle Earth' })
|
||||
.match({ 'name': 'Auckland' });
|
||||
```
|
||||
- id: updating-json-data
|
||||
name: Updating JSON data
|
||||
name: Update JSON data
|
||||
description: |
|
||||
Postgres offers a
|
||||
[number of operators](https://www.postgresql.org/docs/current/functions-json.html)
|
||||
@@ -544,7 +555,7 @@ functions:
|
||||
but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys.
|
||||
code: |
|
||||
```dart
|
||||
final data = await supabase
|
||||
await supabase
|
||||
.from('users')
|
||||
.update({
|
||||
'address': {
|
||||
@@ -554,6 +565,18 @@ functions:
|
||||
})
|
||||
.eq('address->postcode', 90210);
|
||||
```
|
||||
- id: fetch-updated-rows
|
||||
name: Fetch updated rows
|
||||
code: |
|
||||
```dart
|
||||
final List<Map<String, dynamic>> data = await supabase
|
||||
.from('users')
|
||||
.update({
|
||||
'address': {'street': 'Melrose Place', 'postcode': 90210}
|
||||
})
|
||||
.eq('address->postcode', 90210)
|
||||
.select();
|
||||
```
|
||||
|
||||
- id: upsert
|
||||
description: |
|
||||
@@ -568,7 +591,7 @@ functions:
|
||||
isSpotlight: true
|
||||
code: |
|
||||
```dart
|
||||
final data = await supabase
|
||||
await supabase
|
||||
.from('messages')
|
||||
.upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' });
|
||||
```
|
||||
@@ -581,7 +604,7 @@ functions:
|
||||
isSpotlight: true
|
||||
code: |
|
||||
```dart
|
||||
final data = await supabase
|
||||
await supabase
|
||||
.from('users')
|
||||
.upsert({ 'username': 'supabot' }, { 'onConflict': 'username' });
|
||||
```
|
||||
@@ -612,11 +635,21 @@ functions:
|
||||
isSpotlight: true
|
||||
code: |
|
||||
```dart
|
||||
final data = await supabase
|
||||
await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.match({ 'id': 666 });
|
||||
```
|
||||
- id: fetch-delete-records
|
||||
name: Fetch deleted records
|
||||
code: |
|
||||
```dart
|
||||
final List<Map<String,dynamic>> data = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.match({ 'id': 666 })
|
||||
.select();
|
||||
```
|
||||
|
||||
- id: rpc
|
||||
title: 'Stored Procedures: rpc()'
|
||||
|
||||
Reference in new issue
Block a user