Skip to content

how to derive Write[Either[T,U]] #1838

Answered by jatcwang
berserk-fan asked this question in Q&A
Discussion options

You must be logged in to vote

Not generically no. How do we know wheter a result column contains T or U?

What might work for you use to have a sealed trait / enum, and deriving JSON encoder/decoders for it. Then use the doobie's circe integration to read the column. For an example see https://stackoverflow.com/questions/67789229/how-i-can-insert-case-object-as-jsonb-format-via-doobie

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@berserk-fan
Comment options

@jatcwang
Comment options

Answer selected by berserk-fan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants