r2dbc-postgresql icon indicating copy to clipboard operation
r2dbc-postgresql copied to clipboard

Encode/Decode of other Java 8 DateTime types

Open hantsy opened this issue 2 years ago • 2 comments

I tried to use Year type(INT in the db column) in my projects(Spring Boot 3.0.4, R2dbc 1.0, Postgres R2dbc 1.0.1.RELEASE), and got the following exception when run repository test against a Postgres testcontainers instance:

java.lang.IllegalArgumentException: Cannot encode parameter of type java.time.Year (2023)

I think all missing Java 8 DateTime types should be supported in Postgres R2dbc drivers.

  • Year
  • Month
  • DayOfWeek
  • DayOfMonth
  • YearMonth
  • etc.

hantsy avatar Mar 20 '23 03:03 hantsy

Feel free to submit a pull request.

mp911de avatar Mar 20 '23 08:03 mp911de

@hantsy Nice addition, does it work, can you rearrange the code to minimize the diff? getDefaultCodecs() seems to be mostly the same, but is shown as a complete replacement.

reneleonhardt avatar Dec 11 '23 20:12 reneleonhardt