RowDecoder
appears not to be serializable when crezted via RowDecoder.ordered
, due to inheriting GeneratedRowDecoders
and possibly other things. Have you encountered this before?
RowDecoder
?
Decoder
does extend Serializable
, concrete decoders don't appear to. Not sure why
GeneratedRowDecoders
RowDecoder.from
, it won't be serializable either
RowDecoder.from
, somehow
scala> RowDecoder.from(ss => DecodeResult.success(1)).isInstanceOf[Serializable]
res6: Boolean = false
RowDecoder.from
produces serializable instances
val o = QueueEvent.decodeQueueEvent
assert(o.isInstanceOf[Serializable])
decodeQueueEvent
is derived from RowDecoder.from
decodeQueueEvent
is a RowDecoder
?
def discriminatorRowDecoder[C: CellDecoder, A](index: Int)(discriminator: PartialFunction[C, Decode[A]]): RowDecoder[A] =
RowDecoder.from(input => for {
data <- input.lift(index).map(CellDecoder[C].decode).getOrElse(DecodeResult.outOfBounds(index))
discriminated <- discriminator.applyOrElse(data, invalidDiscriminator)(input)
} yield discriminated)
decodeQueueEvent
decodeQueueEvent
is used to decode queue events, it is not a decode queue event. Sorry. That makes more sense
implicit val decodeQueueEvent: RowDecoder[QueueEvent] = discriminatorRowDecoder[String, QueueEvent](4) {
case “ABANDON” => RowDecoder.decoder(0,1,2,5,6,7)(Abandon.apply)
// etc
}
Serializable
. Because RowDecoder.ordered
basically calls RowDecoder.from