Skip to content
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

feat(postgrest): immutability #600

Merged
merged 6 commits into from Aug 24, 2023
Merged

feat(postgrest): immutability #600

merged 6 commits into from Aug 24, 2023

Conversation

Vinzent03
Copy link
Collaborator

@Vinzent03 Vinzent03 commented Aug 23, 2023

Changes

  • Makes the postgrest query building immutable
    Makes the following possible
final query = postgrest.from("table").select();
final res1 = await query.eq("id", 1);
final res2 = await query.gt("id", 2);
  • BREAKING: make PostgrestQueryBuilder.url a required named parameter
  • BREAKING: remove PostgrestBuilder.execute()

@Vinzent03 Vinzent03 marked this pull request as ready for review August 23, 2023 10:43
Copy link
Member

@dshukertjr dshukertjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome!

Could we also add the @immutable annotation to every class that should be immutable?

packages/postgrest/lib/src/postgrest_builder.dart Outdated Show resolved Hide resolved
packages/postgrest/lib/src/postgrest_builder.dart Outdated Show resolved Hide resolved
@dshukertjr
Copy link
Member

On a second thought, maybe we can just do all the "make bunch of things private" in a separate PR.

@Vinzent03
Copy link
Collaborator Author

I've added @immutable only to PostgrestBuilder, because all classes extending that class are immutable as well from the docs:

Used to annotate a class C. Indicates that C and all subtypes of C must be immutable.

@Vinzent03 Vinzent03 merged commit 9525669 into next Aug 24, 2023
7 of 8 checks passed
@Vinzent03 Vinzent03 deleted the feat/immutability branch August 24, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants