parse-community / Parse-Swift

The Swift SDK for Parse Platform (iOS, macOS, watchOS, tvOS, Linux, Android, Windows)
https://parseplatform.org
MIT License
308 stars 69 forks source link

feat: add explain MongoDB queries #314

Closed cbaker6 closed 2 years ago

cbaker6 commented 2 years ago

New Pull Request Checklist

Issue Description

The Swift SDK can't explain MongoDB queries due to a bug on the server-side response. PR https://github.com/parse-community/parse-server/issues/7440 was created on the server, but the server team has chosen not to fix the code.

Originally discussed in: https://community.parseplatform.org/t/explain-result-in-parseswift/1557

Related issue: #N/A https://github.com/parse-community/parse-server/issues/7442

Approach

Add a new internal response type that doesn't expect results to be an array. When the user wants to explain a mongo query, they set the flag, isUsingMongoDB=true. This allows the mongo explained queries to use the same methods as the ones already in the SDK.

TODOs before merging

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this pull request!

codecov[bot] commented 2 years ago

Codecov Report

Merging #314 (cd8b006) into main (e6c2db2) will increase coverage by 0.00%. The diff coverage is 94.05%.

Impacted file tree graph

@@           Coverage Diff            @@
##             main     #314    +/-   ##
========================================
  Coverage   84.62%   84.62%            
========================================
  Files         114      114            
  Lines       11718    11845   +127     
========================================
+ Hits         9916    10024   +108     
- Misses       1802     1821    +19     
Impacted Files Coverage Δ
Sources/ParseSwift/API/Responses.swift 91.25% <ø> (ø)
Sources/ParseSwift/Types/Query.swift 92.28% <92.81%> (-0.89%) :arrow_down:
Sources/ParseSwift/Types/Query+async.swift 100.00% <100.00%> (ø)
Sources/ParseSwift/Types/Query+combine.swift 100.00% <100.00%> (ø)
Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift 72.92% <0.00%> (-0.60%) :arrow_down:

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 e6c2db2...cd8b006. Read the comment docs.