We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
setup:
example:
import skunk._ import skunk.implicits._ import skunk.codec.all._ opaque type AchievId = Long opaque type AchievTitle = String opaque type AchievDesc = String opaque type AchievIconUrl = String opaque type AchievPoints = Int opaque type AchievSecret = Boolean case class AchievementEntity( id: AchievId, title: AchievTitle, description: AchievDesc, iconUrl: AchievIconUrl, points: AchievPoints, isSecret: AchievSecret, ) val codec: Codec[AchievementEntity] = (int8 ~ varchar ~ text ~ varchar ~ int4 ~ bool) .imap { case id ~ title ~ desc ~ iconUrl ~ points ~ isSecret => AchievementEntity( AchievId(id), AchievTitle(title), AchievDesc(desc), AchievIconUrl(iconUrl), AchievPoints(points), AchievSecret(isSecret), ) }(e => e.id ~ e.title ~ e.description ~ e.iconUrl ~ e.points ~ e.isSecret)
Compile error:
[error] -- [E007] Type Mismatch Error: D:\Dev\Projects\Achievements\achievements_server\src\main\scala\io\achievements\persistence\achievement\package.scala:22:13 [error] 22 | }(e => e.id ~ e.title ~ e.description ~ e.iconUrl ~ e.points ~ e.isSecret) [error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [error] | Found: (((((io.achievements.domain.achievement.AchievId, [error] | io.achievements.domain.achievement.AchievTitle [error] | ), io.achievements.domain.achievement.AchievDesc), [error] | io.achievements.domain.achievement.AchievIconUrl [error] | ), io.achievements.domain.achievement.AchievPoints), [error] | io.achievements.domain.achievement.AchievSecret [error] | ) [error] | Required: (((((Long, String), String), String), Int), Boolean) [error] one error found [error] one error found [error] (Compile / compileIncremental) Compilation failed
The text was updated successfully, but these errors were encountered:
Problem solved: need to define codec in same context with opaque types.
Sorry, something went wrong.
No branches or pull requests
setup:
example:
Compile error:
The text was updated successfully, but these errors were encountered: