supabase / postgrest-dart

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

Refactor options param (map type) into named parameters #6

Closed phamhieu closed 4 years ago

phamhieu commented 4 years ago

This is a Hacktoberfest task! You can read more about Hacktoberfest on our blog and see all tasks on our Hacktoberfest Project Board.

Summary

We need help with refactoring options Map param into named parameters.

Example: let take a look at the PostgrestClient class constructor. It has an optional param options which is a Map.

/// You can also provide [options] with `headers` and `schema` key-value if needed
PostgrestClient(String url, [Map<String, dynamic> options = const {}])

It will be more convenient to convert options into named parameters:

PostgrestClient(String url, {Map<String, String> headers, String schema})

Details

There are many options params on the source code

PostgrestClient(String url, [Map<String, dynamic> options = const {}])

PostgrestBuilder insert(dynamic values, [Map options = const {'upsert': false}]) 

PostgrestTransformBuilder order(String column, [Map options = const {'ascending': false, 'nullsFirst': false, 'foreignTable': null}])

PostgrestTransformBuilder limit(int count, [Map options = const {'foreignTable': null}])

PostgrestTransformBuilder range(int from, int to, [Map options = const {'foreignTable': null}])

PostgrestFilterBuilder fts(String column, String query, [Map options = const {'config': null}])

PostgrestFilterBuilder plfts(String column, String query, [Map options = const {'config': null}])

PostgrestFilterBuilder phfts(String column, String query, [Map options = const {'config': null}])

PostgrestFilterBuilder wfts(String column, String query, [Map options = const {'config': null}])
duythien0912 commented 4 years ago

🙌 I would like to take this issue too could you assign me

kiwicopple commented 4 years ago

Nice one @duythien0912 - loving your work on this repo

duythien0912 commented 4 years ago

Yess love to contribute more 🎉