Implementation follows the onboarding guide here.
The gqlgen.yml has been slighly modified to improve readability and fix compilation errors.
# This is required to solve the duplicate generation,
# see https://github.com/99designs/gqlgen/issues/227#issuecomment-1787159496
autobind:
- github.com/99designs/gqlgen/graphql/introspection
# ...
Most code in this repository is generated, so its only necessary to update the following files:
- Definitions in mutate.graphql and schema.
- Resolvers in ent.resolvers.go and mutate.resolvers.go.
You can generate everything using go generate . and start the server using go run cmd/main.go. The GraphQL-Playground is then available at http://localhost:8081/.
query AllTeams {
teams(
last: 5
orderBy: {direction: ASC, field: NAME}
where: {not: {nameIn: ["123"]}}
) {
edges {
node {
id
name
applications {
edges {
node {
id
name
zone
}
cursor
}
}
}
}
totalCount
}
}
query AllApplications {
applications(last: 20) {
edges {
node {
id
owner {
id
name
}
}
}
}
}
mutation CreateTeam {
createTeam(input: {name: "cust", group: "any", type: CUSTOMER}) {
id
name
group
type
createdAt
}
createApplication(
input: {name: "foo", zone: "aws", clientid: "foo-user", clientsecret: "topsecret"}
) {
id
}
}
query NodeTest {
node(id: "2") {
id
... on Team {
name
}
}
}