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: Add isNull QueryConstraint and set/foreset null operations #308

Merged
merged 5 commits into from
Jan 3, 2022

Conversation

cbaker6
Copy link
Contributor

@cbaker6 cbaker6 commented Jan 2, 2022

New Pull Request Checklist

Issue Description

  • The SDK currently doesn't have the ability to query for null or to set a value to null on the server.
  • When the same constraint is added for a query, encoding can be slower since the constraints are saved in array leaving the encoder to encode the same constraint multiple times for no reason.

Related issue: #n/a

Approach

  • Add the isNull and isNotNull query constraints along with the ability to set a field to null on the server when using operations. Note that this is different from querying for doesNotExist or using the Unset operation which produces (undefined) on the server (MongoDB and Postgres) and dashboard. Setting a value to null on a Parse Server using MongoDB produces (null). The results from using the isNull QueryConstraint will yield values that are either (null) or (undefined). Using the doesNotExist QueryConstraint yields results that are only (undefined). Conversely, similar behavior is added for isNotNull and exists. For Postgres, this doesn't matter, and the counterparts mentioned above produce the same results. For both MongoDB and Postgres, it recommended to setup your databases and query in a way that is efficient for your particular index's and setup.

  • Improve QueryWhere by making at a Set of QueryConstraint's instead of any array. This dedupes the same constraint when encoding the query, improving the encoding speed.

TODOs before merging

  • Add tests
  • Remove throw from operation methods which don't need to be thrown
  • Add entry to changelog
  • Add changes to documentation (guides, repository pages, in-code descriptions)

@parse-github-assistant
Copy link

parse-github-assistant bot commented Jan 2, 2022

Thanks for opening this pull request!

  • ❌ Please link an issue that describes the reason for this pull request, otherwise your pull request will be closed. Make sure to write it as Closes: #123 in the PR description, so I can recognize it.

@codecov
Copy link

codecov bot commented Jan 2, 2022

Codecov Report

Merging #308 (04d74db) into main (fdbb1d9) will increase coverage by 0.03%.
The diff coverage is 92.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #308      +/-   ##
==========================================
+ Coverage   84.56%   84.59%   +0.03%     
==========================================
  Files         114      114              
  Lines       11661    11700      +39     
==========================================
+ Hits         9861     9898      +37     
- Misses       1800     1802       +2     
Impacted Files Coverage Δ
Sources/ParseSwift/Types/QueryConstraint.swift 96.99% <86.66%> (-0.51%) ⬇️
Sources/ParseSwift/Types/ParseOperation.swift 94.71% <100.00%> (+0.35%) ⬆️
Sources/ParseSwift/Types/QueryWhere.swift 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fdbb1d9...04d74db. Read the comment docs.

@parse-github-assistant
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title feat: add isNull QueryConstraint and set/foreset null operations feat: Add isNull QueryConstraint and set/foreset null operations Jun 15, 2023
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

1 participant