add dt_SQL_subtract to DateMethods1 #95
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
This pull request adds the new method
dt_SQL_subtract
toDBIx::Class::Helper::ResultSet::DateMethods1
It works exactly like
dt_SQL_add
, but subtracts dates (surprise!).While one can pass negative values to
dt_SQL_add
to subtract a literal value ($amount
), this does not work when the value is not passed as a literal value but as the name of another column where the actual value is stored. Hence this new method.Besides the code and some docs I've added test for sqlite and postgres. As I don't have access to other database engines (and could not figure out how to connect the tests to mysql running in Docker), I did not add tests for those engines.
Please note that this work was sponsored by ctrlo.com. I have not added a note to the docs yet, but maybe it would be a nice touch to honor their support for open source software.
Greetings,
domm