Skip to content

Instantly share code, notes, and snippets.

@huntc
Last active July 13, 2018 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huntc/65dafc5b737d4cc1fe0492d52379c2e3 to your computer and use it in GitHub Desktop.
Save huntc/65dafc5b737d4cc1fe0492d52379c2e3 to your computer and use it in GitHub Desktop.
OO inheritance for data modelling - describes types of events that share a common identifier
sealed abstract class Event(val id: Int)
final case class CountersUpdated(override val id: Int,
counter: Option[Int])
extends Event(id)
final case class DeviceIdUpdated(override val id: Int, deviceId: Int) extends Event(id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment