-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flesh out Reader and Writer APIs (#56)
* Flesh out Reader and Writer APIs We are missing many combinators for those type classes. * Add Reader and Writer tests
- Loading branch information
Georgi Krastev
authored
Sep 21, 2020
1 parent
edb296c
commit 1bfeffe
Showing
6 changed files
with
336 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package io.moia.protos.teleproto | ||
|
||
import java.time.Instant | ||
|
||
import com.google.protobuf.duration.{Duration => PBDuration} | ||
import com.google.protobuf.timestamp.Timestamp | ||
|
||
import scala.concurrent.duration.Duration | ||
|
||
object TestData { | ||
final case class Protobuf( | ||
id: Option[String], | ||
price: Option[String], | ||
time: Option[Timestamp], | ||
duration: Option[PBDuration], | ||
pickupId: Option[String], | ||
prices: Seq[String], | ||
discounts: Map[String, String] | ||
) | ||
|
||
final case class Model( | ||
id: String, | ||
price: BigDecimal, | ||
time: Instant, | ||
duration: Duration, | ||
pickupId: Option[String], | ||
prices: List[BigDecimal], | ||
discounts: Map[String, BigDecimal] | ||
) | ||
|
||
final case class ProtobufLight( | ||
id: Option[String], | ||
price: Option[String], | ||
time: Option[Timestamp], | ||
duration: Option[PBDuration] | ||
) { | ||
def complete( | ||
pickupId: Option[String] = None, | ||
prices: Seq[String] = Nil, | ||
discounts: Map[String, String] = Map.empty | ||
): Protobuf = Protobuf(id, price, time, duration, pickupId, prices, discounts) | ||
} | ||
|
||
final case class ModelLight( | ||
id: String, | ||
price: BigDecimal, | ||
time: Instant, | ||
duration: Duration | ||
) { | ||
def complete( | ||
pickupId: Option[String] = None, | ||
prices: List[BigDecimal] = Nil, | ||
discounts: Map[String, BigDecimal] = Map.empty | ||
): Model = Model(id, price, time, duration, pickupId, prices, discounts) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.