Skip to content

Instantly share code, notes, and snippets.

@DenisBronx
Created September 3, 2019 22:56
Show Gist options
  • Save DenisBronx/05a5a3160eb4a6afe63abf5b1c2bcd20 to your computer and use it in GitHub Desktop.
Save DenisBronx/05a5a3160eb4a6afe63abf5b1c2bcd20 to your computer and use it in GitHub Desktop.
Repository Pattern Product with new field
// Entity
data class Product(
val id: String,
val name: String,
val price: Price,
val isFavourite: Boolean
) {
// Value object
data class Price(
val nowPrice: Double,
val wasPrice: Double
) {
companion object {
val EMPTY = Price(0.0, 0.0)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment