-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30eb1a3
commit 65adcf7
Showing
21 changed files
with
461 additions
and
209 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
modules/benchmarks/src/main/scala-2/json/bench/tethysjson/TethysBench.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package json.bench.tethysjson | ||
|
||
import json.bench.{DataReader, DataWriter} | ||
import json.bench.model.Data | ||
import tethys._ | ||
import tethys.jackson._ | ||
|
||
object TethysBench { | ||
|
||
implicit val dataWriter: JsonWriter[Data] = tethys.derivation.semiauto.jsonWriter[Data] | ||
implicit val dataReader: JsonReader[Data] = tethys.derivation.semiauto.jsonReader[Data] | ||
|
||
object TethysJacksonDataProcessor extends DataWriter with DataReader { | ||
|
||
override def write(seq: Seq[Data]): String = seq.asJson | ||
|
||
override def read(json: String): Seq[Data] = json.jsonAs[Seq[Data]].toOption.get | ||
} | ||
} |
5 changes: 2 additions & 3 deletions
5
...a/json/bench/tethysjson/TethysBench.scala → ...3/json/bench/tethysjson/TethysBench.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
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
2 changes: 1 addition & 1 deletion
2
...a-3/tethys/derivation/ReaderBuilder.scala → ...c/main/scala-3/tethys/ReaderBuilder.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,4 +1,4 @@ | ||
package tethys.derivation | ||
package tethys | ||
|
||
import tethys.{FieldStyle, JsonReader} | ||
|
||
|
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,37 @@ | ||
package tethys | ||
|
||
import tethys.FieldStyle | ||
|
||
sealed trait WriterBuilder[A]: | ||
import WriterBuilder.* | ||
|
||
def add(name: String): FunApply0[A, A] | ||
|
||
def remove[B](field: A => B): WriterBuilder[A] | ||
|
||
def rename[B](field: A => B)(rename: String): WriterBuilder[A] | ||
|
||
def update[B](field: A => B): FunApply[A, B] with WithRename[FunApply[A, B]] | ||
|
||
@deprecated("Use 'update' instead.") | ||
def updatePartial[B](field: A => B): FunApply[A, B] with WithRename[FunApply[A, B]] | ||
|
||
def fieldStyle(style: FieldStyle): WriterBuilder[A] | ||
|
||
|
||
object WriterBuilder: | ||
def apply[A](using mirror: scala.deriving.Mirror.ProductOf[A]): WriterBuilder[A] = | ||
throw IllegalStateException("Config must be an inlined given or provided directly to 'derived'") | ||
|
||
sealed trait WithRename[Res]: | ||
def withRename(rename: String): Res | ||
|
||
sealed trait FunApply0[A, B]: | ||
def apply[C](fun: B => C): WriterBuilder[A] | ||
|
||
sealed trait FunApply[A, B] extends FunApply0[A, B]: | ||
def fromRoot[C](fun: A => C): WriterBuilder[A] | ||
|
||
|
||
sealed trait JsonWriterSumConfig[A]: | ||
def fieldStyle(style: FieldStyle): JsonWriterSumConfig[A] |
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.