feat: Added docs for stream()

This commit is contained in:
dshukertjr committed 2021-08-16 20:25:22 +09:00
1 parent 123c353dbc
commit d9a71fc609
3 files changed
+88 -5

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
- `cd /web/spec/`
- run `make` which will pull the latest TSDoc with your updates
- add your comments to `supabase.yml` | `postgrest.yml` | `gotrue.yml` | `realtime.yml`
- add your comments to `supabase.yml` | `dart.yml` | `postgrest.yml` | `gotrue.yml` | `realtime.yml`
- run `npm run gen:supabase` inside the `/spec` folder which will generate the Docusaurus pages
- run `npm run build` to make sure the build is working
- submit your PR
+37 -1
View File
@@ -9,7 +9,43 @@ module.exports = {
{
type: 'category',
label: 'Auth',
items: ['reference/dart/auth-signup', 'reference/dart/auth-signin', 'reference/dart/auth-signout', 'reference/dart/auth-session', 'reference/dart/auth-user', 'reference/dart/auth-update', 'reference/dart/auth-onauthstatechange', 'reference/dart/reset-password-email', 'reference/dart/delete-user'],
items: ['reference/dart/auth-signup', 'reference/dart/auth-signin', 'reference/dart/auth-signinwithprovider', 'reference/dart/auth-signout', 'reference/dart/auth-session', 'reference/dart/auth-user', 'reference/dart/auth-update', 'reference/dart/auth-onauthstatechange', 'reference/dart/reset-password-email'],
collapsed: true,
},
{
type: 'category',
label: 'Data',
items: ['reference/dart/select', 'reference/dart/insert', 'reference/dart/update', 'reference/dart/upsert', 'reference/dart/delete', 'reference/dart/rpc'],
collapsed: true,
},
{
type: 'category',
label: 'Realtime',
items: ['reference/dart/subscribe', 'reference/dart/removesubscription', 'reference/dart/getsubscriptions'],
collapsed: true,
},
{
type: 'category',
label: 'Stream',
items: ['reference/dart/stream'],
collapsed: true,
},
{
type: 'category',
label: 'Storage',
items: ['reference/dart/storage-createbucket', 'reference/dart/storage-getbucket', 'reference/dart/storage-listbuckets', 'reference/dart/storage-updatebucket', 'reference/dart/storage-deletebucket', 'reference/dart/storage-emptybucket', 'reference/dart/storage-from-upload', 'reference/dart/storage-from-download', 'reference/dart/storage-from-list', 'reference/dart/storage-from-update', 'reference/dart/storage-from-move', 'reference/dart/storage-from-remove', 'reference/dart/storage-from-createsignedurl', 'reference/dart/storage-from-getpublicurl'],
collapsed: true,
},
{
type: 'category',
label: 'Modifiers',
items: ['reference/dart/using-modifiers', 'reference/dart/limit', 'reference/dart/order', 'reference/dart/range', 'reference/dart/single'],
collapsed: true,
},
{
type: 'category',
label: 'Filters',
items: ['reference/dart/using-filters', 'reference/dart/filter', 'reference/dart/or', 'reference/dart/not', 'reference/dart/match', 'reference/dart/eq', 'reference/dart/neq', 'reference/dart/gt', 'reference/dart/gte', 'reference/dart/lt', 'reference/dart/lte', 'reference/dart/like', 'reference/dart/ilike', 'reference/dart/contains', 'reference/dart/containedby', 'reference/dart/rangelt', 'reference/dart/rangegt', 'reference/dart/rangegte', 'reference/dart/rangelte', 'reference/dart/rangeadjacent', 'reference/dart/overlaps', 'reference/dart/textsearch'],
collapsed: true,
}
],
+50 -3
View File
@@ -43,9 +43,9 @@ info:
- subscribe()
- removeSubscription()
- getSubscriptions()
# - name: 'Stream'
# items:
# - stream()
- name: 'Stream'
items:
- stream()
- name: 'Storage'
items:
- storage.createBucket()
@@ -724,6 +724,53 @@ pages:
```dart
final subscriptions = supabase.getSubscriptions();
```
stream():
title: 'stream()'
notes: |
- `stream()` will emit the initial data as well as any further change on the database as `Stream` of `List<Map<String, dynamic>>` by combining Postgrest and Realtime.
- Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime).
examples:
- name: Listening to a specific table
isSpotlight: true
dart: |
```dart
supabase
.from('countries')
.stream()
.execute();
```
- name: Listening to a specific rows within a table
description: |
You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match.
This syntax is the as how you can filter data in Realtime
dart: |
```dart
supabase
.from('countries:id=eq.120')
.stream()
.execute();
```
- name: With `order()`
dart: |
```dart
supabase
.from('countries')
.stream()
.order('name', ascending: false)
.execute();
```
- name: With `limit()`
dart: |
```dart
supabase
.from('countries')
.stream()
.order('name', ascending: false)
.limit(10)
.execute();
```
storage.listBuckets():
title: 'listBuckets()'
$ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.listBuckets'