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
package caliban | |
import caliban.GraphQL._ | |
import zio.console.putStrLn | |
import zio.ZIO | |
import zio.zquery._ | |
object Test extends zio.App { | |
case class User(firstName: UQuery[String], lastName: UQuery[String], age: UQuery[Int]) |
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
package caliban | |
import caliban.GraphQL._ | |
import zio.ZIO | |
import zio.console.putStrLn | |
import zio.zquery._ | |
object Test2 extends zio.App { | |
case class User(firstName: UQuery[String], lastName: UQuery[String], age: UQuery[Int]) |
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
import scala.deriving.Mirror | |
import scala.compiletime._ | |
trait Schema[T] | |
object Schema { | |
implicit val stringSchema: Schema[String] = new Schema[String] {} | |
implicit def listSchema[A](implicit ev: Schema[A]): Schema[List[A]] = new Schema[List[A]] {} | |
implicit def mapSchema[A, B](implicit evA: Schema[A], evB: Schema[B]): Schema[Map[A, B]] = | |
new Schema[Map[A, B]] {} |
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
//> using dep com.github.ghostdogpr::caliban:2.2.0 | |
import caliban._ | |
import caliban.schema._ | |
case class Queries(books: List[Book]) derives Schema.SemiAuto | |
case class Book(id: Int, name: String) derives Schema.SemiAuto | |
val api = graphQL(RootResolver(Queries(Nil))) |
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
//> using dep com.github.ghostdogpr::caliban-quick:2.5.0 | |
// 1. Defining the schema | |
enum Origin { | |
case EARTH, MARS, BELT | |
} | |
case class Character(name: String, nicknames: List[String], origin: Origin) |
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
[ | |
{ | |
"jmhVersion" : "1.37", | |
"benchmark" : "caliban.ComplexQueryBenchmark.runCaliban", | |
"mode" : "thrpt", | |
"threads" : 1, | |
"forks" : 1, | |
"jvm" : "/Users/pierre/Library/Java/JavaVirtualMachines/temurin-21.0.3/Contents/Home/bin/java", | |
"jvmArgs" : [ | |
], |
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
//> using dep com.github.ghostdogpr::caliban-quick:2.7.1 | |
import caliban.* | |
import caliban.CalibanError.* | |
import caliban.Value.StringValue | |
import caliban.execution.FieldInfo | |
import caliban.parsing.adt.Directive | |
import caliban.quick.* | |
import caliban.schema.Annotations.* | |
import caliban.schema.Schema |
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
//> using dep com.github.ghostdogpr::caliban-tapir:2.8.0 | |
//> using dep com.softwaremill.ox::core:0.2.2 | |
//> using dep com.softwaremill.sttp.tapir::tapir-jsoniter-scala:1.10.10 | |
//> using dep com.softwaremill.sttp.tapir::tapir-netty-server-sync:1.10.10 | |
import caliban.* | |
import caliban.interop.tapir.* | |
import caliban.schema.Schema | |
import _root_.ox.* | |
import scala.concurrent.duration.* |
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
//> using dep dev.zio::zio:2.1.11 | |
//> using dep dev.zio::zio-config-magnolia:4.0.2 | |
//> using dep com.softwaremill.sttp.client3::zio:3.10.1 | |
import sttp.client3.httpclient.zio.HttpClientZioBackend | |
import zio.* | |
import zio.config.derivation.name | |
import zio.config.magnolia.deriveConfig | |
type Language = String |
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
import java.nio.file.Path | |
import scala.meta.* | |
object CodeGenerator { | |
import dialects.Scala213Source3 | |
private val emptyTree = "".parse[Source].get | |
def generateLenses(path: Path): String = { | |
val files = os.walk(os.Path(path)).toList.filterNot(os.isDir) |