All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.googleapis.firebase.JsonInstances.scala Maven / Gradle / Ivy

package googleapis.firebase

import io.circe._
import scala.concurrent.duration._
import scodec.bits._

private[firebase] object JsonInstances {
  implicit val durationEncoder: Encoder[FiniteDuration] = Encoder[Long].contramap(_.toMillis)
  implicit val durationDecoder: Decoder[FiniteDuration] = Decoder[Long].map(_.millis)

  implicit val byteVectorEncoder: Encoder[ByteVector] = Encoder[String].contramap(_.toBase64)
  implicit val byteVectorDecoder: Decoder[ByteVector] =
    Decoder[String].emap(bv => ByteVector.fromBase64Descriptive(bv))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy