prefetch

command
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2025 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

This example demonstrates a 3-level hierarchy (Author -> Books -> Reviews) with data prefetching at each level to avoid N+1 query problems. To run the example, execute:

go run example/prefetch/main.go

Then send a query like this (using curl or any GraphQL client):

curl -X POST http://localhost:8080/query \
   -H 'Content-Type: application/json' \
   -d '{"query":"query GetAuthors($top:Int!,$last:Int!){ authors { id name books(top:$top){ id title reviews(last:$last){ id content rating } } }}","variables":{"top":2,"last":2}}'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL