Skip to content

xcheng85/simple-graphql-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-graph-ql

go mod init github.com/xcheng85/simple-graphql-go

go get github.com/99designs/gqlgen

go run github.com/99designs/gqlgen init

go get github.com/99designs/gqlgen/graphql/handler

# after graphql schema is updated
go get github.com/99designs/gqlgen@v0.17.30
go run github.com/99designs/gqlgen generate

# for advanced graphql schema
https://github.com/99designs/gqlgen/tree/master/_examples


query{
  players(){
    id
  }
}

//enum input has no "" 

mutation {
  addPlayer(player: {First: "Roger", Last: "Federer", Country: SWISS, Gender: MALE}){
    id
  }
}

mutation {
  addPlayer(player: {First: "Rafael", Last: "Nadal", Country: SPAIN, Gender: MALE}){
    id
  }
}

mutation ($first: String!){
  addPlayer(player: {First: $first, Last: "Federer", Country: SWISS, Gender: MALE}){
    id
  }
}

variables:

{
  "first": "Roger"
}

query{
  player(id:0){
    id
    First
    Last
    Country
    Gender
  }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages