From f37dffdd983e780d4fb45615b0b6fd7d175698ac Mon Sep 17 00:00:00 2001 From: Pierre Ricadat Date: Tue, 5 Nov 2019 22:26:40 +0900 Subject: [PATCH] Update schema.md --- vuepress/docs/docs/schema.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vuepress/docs/docs/schema.md b/vuepress/docs/docs/schema.md index 59ded3c46..603bc12e8 100644 --- a/vuepress/docs/docs/schema.md +++ b/vuepress/docs/docs/schema.md @@ -106,6 +106,11 @@ Caliban provides auto-derivation for common types such as `Int`, `String`, `List ## Effects Fields can return ZIO effects. This allows you to leverage all the features provided by ZIO: timeouts, retries, access to ZIO environment, memoizing, etc. An effect will be ran every time a query requiring the corresponding field is executed. +```scala +case class Queries(characters: Task[List[Character]], + character: CharacterName => RIO[Console, Character]) +``` + If you don't use ZIO environment (`R` = `Any`), there is nothing special to do to get it working. If you require a ZIO environment, you will need to have the content of `caliban.schema.GenericSchema[R]` for your custom `R` in scope when you call `graphQL(...)`. @@ -132,4 +137,4 @@ You can also use the `scalarSchema` helper to create your own scalar types, prov ```scala import caliban.schema._ implicit val unitSchema: Schema[Unit] = scalarSchema("Unit", None, _ => ObjectValue(Nil)) -``` \ No newline at end of file +```