Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 477d612

Browse files
committedApr 13, 2023
feature: Adds async resolver usage info
1 parent dfbefc2 commit 477d612

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

‎README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,19 @@ The output will be:
219219

220220
#### Async resolvers
221221

222-
To use async resolvers, just add one more parameter with type `EventLoopGroup` to the resolver function and change the return type to `EventLoopFuture<YouReturnType>`. Don't forget to import NIO.
222+
Resolver functions can also be `async`:
223+
224+
```swift
225+
struct Resolver {
226+
func message(context: Context, arguments: NoArguments) async -> Message {
227+
await someAsyncMethodToGetMessage()
228+
}
229+
}
230+
```
231+
232+
#### NIO resolvers
233+
234+
The resolver functions also support `NIO`-style concurrency. To do so, just add one more parameter with type `EventLoopGroup` to the resolver function and change the return type to `EventLoopFuture<YouReturnType>`. Don't forget to import NIO.
223235

224236
```swift
225237
import NIO

0 commit comments

Comments
 (0)
Please sign in to comment.