supabase / postgrest-dart

Dart client for PostgREST
https://supabase.com
MIT License
136 stars 38 forks source link

Add returning option back to insert #87

Closed HankG closed 2 years ago

HankG commented 2 years ago

The returning option on the insert method was excised in PR #80 . This adds that option back, sets it to the desired new default behavior minimal and updates the documentation to reflect that status. I added an example of overriding the behavior in the documentation as well.

dshukertjr commented 2 years ago

Thanks @HankG for opening a PR!

Sorry for not providing much description in #80. I have added some description just now. Taking out return option was an intentional change. With the new update, you can add select() at the end of the query to get the inserted or updated results like this:

final data = await Supabase.instance.client
  .from('my_table')
  .insert({'name': 'my_name'})
  .select();

I would like to close this PR, but do really appreciate it, and look forward to seeing other works in the future!

bdlukaa commented 2 years ago

This looks like the same as https://github.com/supabase-community/postgrest-dart/pull/82.

Removing returning is by design. To return the data, add .select() to the end of your query!

HankG commented 2 years ago

This looks like the same as #82.

Removing returning is by design. To return the data, add .select() to the end of your query!

Oh didn't realize that. Maybe remove the code change but update the documentation to show how to do that with the correct syntax and to reflect the new default of not returning data?