Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Discussion: Use Codec Composition for Joins #552

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

Closed
sinanspd opened this issue Feb 8, 2022 · 0 comments
Closed

Discussion: Use Codec Composition for Joins #552

sinanspd opened this issue Feb 8, 2022 · 0 comments

Comments

@sinanspd
Copy link

sinanspd commented Feb 8, 2022

Currently schemas that require a Join query are defined similar to the following:

 val decoder: Decoder[Item] =
    (itemId ~ itemName ~ itemDesc ~ money ~ brandId ~ brandName ~ categoryId ~ categoryName).map {
      case i ~ n ~ d ~ p ~ bi ~ bn ~ ci ~ cn =>
        Item(i, n, d, p, Brand(bi, bn), Category(ci, cn))
    }

I would like to argue that this doesn't scale well and isn't very pretty (at least at scale). Given that we already have Codecs for Brand and Category so I think this Decoder should be defined in terms of composition (which as functional idea is also worth iterating once again here).

This would require the SQL objects to be at least package private

Opening the issue for discussion but happy to make a PR if people are open to it

Repository owner locked and limited conversation to collaborators Feb 10, 2022
@gvolpe gvolpe converted this issue into discussion #553 Feb 10, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant