-
Notifications
You must be signed in to change notification settings - Fork 409
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
Use ExtractParameters
in handlers
#2620
Use ExtractParameters
in handlers
#2620
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2620 +/- ##
===========================================
- Coverage 66.24% 28.69% -37.56%
===========================================
Files 419 419
Lines 20703 20444 -259
===========================================
- Hits 13715 5866 -7849
- Misses 6036 13985 +7949
+ Partials 952 593 -359
... and 121 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more. |
…s' into issue-2465-use-extract-parameters
@w84thesun this pull request has merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 🤗 My comments are mainly just catching corner cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started reviewing (not a full review yet).
New tags seem useful!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started reviewing (not a full review yet).
New tags seem useful!
Co-authored-by: Chi Fujii <chi.fujii@ferretdb.io>
…s' into issue-2465-use-extract-parameters
Co-authored-by: Chi Fujii <chi.fujii@ferretdb.io>
…s' into issue-2465-use-extract-parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I like the tests, and the returned errors look reasonable to me.
I see a bit of inconsistency in function names, but I think we can fix them later when we meet this inconsistency somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Description
Closes #2465.
In this PR I changed the
delete
,distinct
,find
,findAndModify
,insert
andupdate
handlers to extract parameters with theExtractParam
function.explain
has to be implemented separately as its behaviour is slightly different from other handlers.I added support for the following new tags:
positiveNumber
- provided value must be of types [int, long, double] and greater than 0,double values would be rounded to long;
wholePositiveNumber
- provided value must be of types [int, long] and greater than 0;numericBool
- provided value must be of types [bool, int, long, double] and would be converted to bool;zeroOrOneAsBool
- provided value must be of types [int, long, double] with possible values0
or1
.Please suggest better naming for
numericBool
andzeroOrOneAsBool
.Those are needed to choose from different numeric parameter functions like
GetBoolOptionalParam
orgetWholeParamStrict
. We can remove them if we will decide to unify the way we process parameters.Some of the error messages were unified to form
BSON <handler>.<parameter> has wrong ...
Readiness checklist
task all
, and it passed.@FerretDB/core
), Labels, Project and project's Sprint fields.