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

add dt_SQL_subtract to DateMethods1 #95

Closed
wants to merge 6 commits into from
Closed

Conversation

domm
Copy link
Contributor

@domm domm commented Jul 20, 2019

Hi!

This pull request adds the new method dt_SQL_subtract to DBIx::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

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 98.729% when pulling 0cf7213 on domm:master into ba9ab1b on frioux:master.

@frioux
Copy link
Owner

frioux commented Jul 20, 2019

Thanks! Go ahead and credit ctrlo for this. Then could you squash all commits except the maint/explain one, since as far as I can tell they are all part of a single unit?

@domm domm closed this Jul 22, 2019
@domm domm deleted the master branch July 22, 2019 18:24
@frioux
Copy link
Owner

frioux commented Jul 22, 2019 via email

@domm
Copy link
Contributor Author

domm commented Jul 22, 2019 via email

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

3 participants