-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #565 from ronnnnnnnnnnnnn/feature/355-support-poly…
…morphic-keys Support polymorphic keys
- Loading branch information
Showing
54 changed files
with
435 additions
and
490 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
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
14 changes: 7 additions & 7 deletions
14
modules/circe/src/main/scala/scalacache/serialization/Circe.scala
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
package scalacache.serialization | ||
|
||
import java.nio.ByteBuffer | ||
|
||
import io.circe.jawn.JawnParser | ||
import io.circe.{Decoder, Encoder} | ||
import scalacache.serialization.binary.BinaryCodec | ||
|
||
package object circe { | ||
|
||
private[this] val parser = new JawnParser | ||
|
||
implicit def codec[A](implicit encoder: Encoder[A], decoder: Decoder[A]): Codec[A] = new Codec[A] { | ||
implicit def codec[A](implicit encoder: io.circe.Encoder[A], decoder: io.circe.Decoder[A]): BinaryCodec[A] = | ||
new BinaryCodec[A] { | ||
|
||
override def encode(value: A): Array[Byte] = encoder.apply(value).noSpaces.getBytes("utf-8") | ||
override def encode(value: A): Array[Byte] = encoder.apply(value).noSpaces.getBytes("utf-8") | ||
|
||
override def decode(bytes: Array[Byte]): Codec.DecodingResult[A] = | ||
parser.decodeByteBuffer(ByteBuffer.wrap(bytes)).left.map(FailedToDecode) | ||
override def decode(bytes: Array[Byte]): Codec.DecodingResult[A] = | ||
parser.decodeByteBuffer(ByteBuffer.wrap(bytes)).left.map(FailedToDecode) | ||
|
||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.