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 support for skunk #192

Merged
merged 7 commits into from
Nov 19, 2023
Merged

Add support for skunk #192

merged 7 commits into from
Nov 19, 2023

Conversation

jnicoulaud-ledger
Copy link
Contributor

Adds support for Skunk.

@jnicoulaud-ledger
Copy link
Contributor Author

Not sure this is the good way of doing things, if I try the case class example with implicit conversions:

// defining a codec for a refined case class
final case class User(name: Username, age: Int :| Positive)
given Codec[User] = (varchar *: int4).to[User]

Compilation fails with a compiler crash:

java.lang.AssertionError: assertion failed while typechecking /home/jnicoulaud/work/foss/iron/skunk/test/src/io/github/iltotore/iron/SkunkExample.scala

@jnicoulaud-ledger jnicoulaud-ledger marked this pull request as ready for review November 4, 2023 13:19
@Iltotore
Copy link
Owner

Iltotore commented Nov 6, 2023

What is the full error thrown by the compiler?

@jnicoulaud-ledger
Copy link
Contributor Author

@Iltotore
Copy link
Owner

Iltotore commented Nov 10, 2023

The test module, including this part:

// defining a codec for a refined case class
final case class User(name: Username, age: Int :| Positive)
given Codec[User] = (varchar.refined[Not[Blank]] *: int4.refined[Positive]).to[User]

seems to compile and work as expected. Am I missing something?

EDIT: Nevermind, I found the difference.

Copy link
Owner

@Iltotore Iltotore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks good to me. I just think the introduced implicit conversion is not necessary and causes more issues (e.g the compiler crash) than benefits.

skunk/src/io.github.iltotore.iron/skunk.scala Outdated Show resolved Hide resolved
@Iltotore Iltotore merged commit 0b579b4 into Iltotore:main Nov 19, 2023
1 check passed
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.

2 participants