Add support for date_bin (available in postgres >= 14)#648
Merged
tminglei merged 1 commit intotminglei:masterfrom Jun 30, 2023
Merged
Add support for date_bin (available in postgres >= 14)#648tminglei merged 1 commit intotminglei:masterfrom
tminglei merged 1 commit intotminglei:masterfrom
Conversation
hughsimpson
commented
Jun 28, 2023
| r => assert(LocalDateTime.parse("2001-01-03T00:00:00") === r) | ||
| ), | ||
| // dateBin | ||
| DBIO.seq(Option.when(pgVersion.take(2).toInt >= 14)(Datetimes.filter(_.id === 101L.bind).map(r => r.datetime.dateBin("1 hour", LocalDateTime.parse("2001-01-03T18:35:17"))).result.head.map( |
Contributor
Author
There was a problem hiding this comment.
The gnarly little wrapper here (and elsewhere) could be refactored out for a more principled approach to supporting features that're only introduced in later versions of postgres, but I figured I'd test the waters first, and don't currently need any other feature missing from the existing set
Owner
There was a problem hiding this comment.
It doesn't matter, I think, since it's postgresql that really supports these functions, instead of slick-pg.
In fact, slick-pg is just a tool that translates from scala functions to pg functions.
stevetursi
approved these changes
Jun 28, 2023
Owner
|
Merged. Thanks! 👍 |
Contributor
Author
|
@tminglei Thanks for merging this - could you release it? NBD, but does let me drop the shim from my local code |
Owner
|
@hughsimpson released in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I don't know what your take is on functions that're introduced in versions of postgres > 11 - I didn't spot anything similar in the repo already - but this is a pretty handy one, so I thought I might as well give it a shot.