GoLang / Go support

WunderGraph supports Golang out of the box. For all your Operations, we're able to generate a typesafe GoLang / Go client for you, including Queries, Mutations, Subscriptions and Live Queries.

Setup

To use it, follow these steps:

In your wundergraph.config.ts, import the golang client generator:

1
import { golangClient } from '@wundergraph/golang-client';

Then, add it to the codeGenerators of configureWunderGraphApplication:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
configureWunderGraphApplication({
server,
operations,
authorization: {
roles: ['admin', 'user'],
},
codeGenerators: [
{
templates: [
...golangClient.all({
packageName: 'client',
}),
],
path: './generated/golang/client',
},
],
});

As the path, you can choose any path you like. Make sure to define a matching packageName though.

Finally, add the dependency to your go.mod as the generated client depends on it:

1
go get https://github.com/wundergraph/client-go

Examples

Was this article helpful to you?
Provide feedback

Edit this page