Skip to content

[PartialTransformer] Field Option[Field].None to Proto3.Fields.Default #474

Discussion options

You must be logged in to vote

With the information code I cannot reproduce anything as I am missing types (Seq[Map], com.pricespider.unity.domain.ClientProduct.Promo), fields (ClientProductEntity has no PSCBID, PSCID) and in general this code doesn't compile (Option[Seq(Promo)] instead of Option[Seq[Promo]]). So I can only guess, what you want to achieve.

From the description, an I can only guess that you wanted to use default values although default values are used when there is no source field, not when the source field is None. There is no support for using default values as None handling, however for this particular case:

implicit val noneIntIsZero: Transformer[Option[Int], Int] = _.getOrElse(0)
implicit val noneL…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ps-rterzman
Comment options

@MateuszKubuszok
Comment options

Answer selected by ps-rterzman
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
Converted from issue

This discussion was converted from issue #473 on March 05, 2024 11:28.