I have a case class with Options:
case class PersonUpdate(name: Option[String], age: Option[Int], country: Option[String])
and I need to check which values are defined and generate a map with its name and values, for example:
if I have this object:
val perUpdate = PersonUpdate(Option("john"), None, Option("England"))
than the map should look like:
val result = Map("people.$.name" -> "john", "people.$.country" -> "England")
what would be the best way do that efficiently the scala way?