Skip to content

Commit

Permalink
feat: generate a graphql client
Browse files Browse the repository at this point in the history
Signed-off-by: saltbo <[email protected]>
  • Loading branch information
saltbo committed Feb 22, 2023
1 parent 6e6ae86 commit a9d9f11
Show file tree
Hide file tree
Showing 16 changed files with 1,224 additions and 208 deletions.
1 change: 1 addition & 0 deletions apis/generate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package apis

//go:generate go run github.com/99designs/gqlgen generate
//go:generate go run github.com/Khan/genqlient genqlient.yaml
35 changes: 35 additions & 0 deletions apis/genqlient.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
query Find($word: String!) {
vocabulary(name: $word) {
self{
...vocabularyWithChildren
}
root{
...vocabularyWithChildren
}
}
}

fragment vocabulary on Vocabulary {
name
phonetic
mnemonic
meaning
tags
constitute
}

fragment vocabularyWithChildren on Vocabulary {
...vocabulary
children {
...vocabulary
children {
...vocabulary
children {
...vocabulary
children {
...vocabulary
}
}
}
}
}
12 changes: 12 additions & 0 deletions apis/genqlient.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Default genqlient config; for full documentation see:
# https://github.com/Khan/genqlient/blob/main/docs/genqlient.yaml
schema: graph/*.graphqls
operations:
- genqlient.graphql
generated: ../client/generated.go

bindings:
DateTime:
type: time.Time

client_getter: "github.com/bonaysoft/engra/client/context.GetClient"
Loading

0 comments on commit a9d9f11

Please sign in to comment.