Skip to content

Conversation

@kodumbeats
Copy link
Contributor

@kodumbeats kodumbeats commented Apr 30, 2021

This PR introduces a new Queries validator to validate an array of Query objects by:

  • Individually validating each Query object
  • Strict validation: validate the query params can all be found in one index
  • Checks if index is queued for creation during strict validation

Test plan:
Unit tests included

TODO:

  • Handle index order (ASC, DESC, etc)

@eldadfux
Copy link
Member

eldadfux commented May 1, 2021

@kodumbeats I might also add a new collection attributed called "indexesInQueue" to hold pending indexes that are still being created, this will allow us to give a better error messages in this validator.

@kodumbeats kodumbeats marked this pull request as ready for review May 4, 2021 20:08
@kodumbeats
Copy link
Contributor Author

kodumbeats commented May 4, 2021

@eldadfux I'm not 💯 on what is best to pass to the Queries validator constructor. I landed on this approach in acefb92 because passing in Utopia\Database\Database made the code really messy, and I lost the story.

Maybe you have some suggestions on how to best model the new collections in the Queries unit tests:
https://github.com/utopia-php/database/pull/7/files#diff-0817ee1ddaadb2e308dc292229f9d4c4fb1de9cdc2d00a30ac9c9ab528ec1223R16

Copy link
Member

@eldadfux eldadfux left a comment

Choose a reason for hiding this comment

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

Looks very good, left some minor comments. When ready I can merge it and start playing around with it :)

@kodumbeats kodumbeats requested a review from eldadfux May 5, 2021 17:16
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.

2 participants