Skip to content

docs(supabase): update comment docs on stream #482

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

Merged
merged 4 commits into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/supabase/lib/src/supabase_query_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ class SupabaseQueryBuilder extends PostgrestQueryBuilder {
isolate: isolate,
);

/// Notifies of data at the queried table
/// Returns real-time data from your table as a `Stream`.
///
/// [primaryKey] list of name of primary key column(s).
/// Realtime is disabled by default for new tables. You can turn it on by [managing replication](https://supabase.com/docs/guides/realtime/extensions/postgres-changes#replication-setup).
///
/// Pass the list of primary key column names to [primaryKey], which will be used to updating and deleting the proper records internally as the library receives real-time updates.
///
/// ```dart
/// supabase.from('chats').stream(primaryKey: ['my_primary_key']).listen(_onChatsReceived);
/// supabase.from('chats').stream(primaryKey: ['id']).listen(_onChatsReceived);
/// ```
///
/// `eq`, `neq`, `lt`, `lte`, `gt` or `gte` and `order`, `limit` filter are available to limit the data being queried.
///
/// ```dart
/// supabase.from('chats').stream(primaryKey: ['my_primary_key']).eq('room_id','123').order('created_at').limit(20).listen(_onChatsReceived);
/// supabase.from('chats').stream(primaryKey: ['id']).eq('room_id','123').order('created_at').limit(20).listen(_onChatsReceived);
/// ```
SupabaseStreamBuilder stream({required List<String> primaryKey}) {
assert(primaryKey.isNotEmpty, 'Please specify primary key column(s).');
Expand Down