Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blukai/gqlgenc-omitempty-example
https://github.com/blukai/gqlgenc-omitempty-example
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/blukai/gqlgenc-omitempty-example
- Owner: blukai
- Created: 2021-06-03T22:28:58.000Z (over 3 years ago)
- Default Branch: with-omitempty
- Last Pushed: 2021-06-03T23:07:57.000Z (over 3 years ago)
- Last Synced: 2024-06-21T16:57:27.265Z (6 months ago)
- Language: Go
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# gqlgenc-omitempty-example
run [dgraph](https://dgraph.io) in [docker](https://docs.docker.com/engine/install/)
```
$ docker-compose up -d
```set the schema with [dgraph-admin](https://github.com/blukai/dgraph-admin)
```
$ dgraph-admin update-schema schema.graphql
```generate modelds and client with [gqlgenc](https://github.com/Yamashou/gqlgenc)
```
$ gqlgenc
```run the example
```
$ go run main.go
```and the response is fine
```
[]*gen.PlanetFragment{
&gen.PlanetFragment{
ID: "0x2e",
Name: "Jupiter",
Moons: []*struct { ID string "json:\"id\" graphql:\"id\""; Name string "json:\"name\" graphql:\"name\"" }{},
},
&gen.PlanetFragment{
ID: "0x2f",
Name: "Earth",
Moons: []*struct { ID string "json:\"id\" graphql:\"id\""; Name string "json:\"name\" graphql:\"name\"" }{
&struct { ID string "json:\"id\" graphql:\"id\""; Name string "json:\"name\" graphql:\"name\"" }{
ID: "0x30",
Name: "Moon",
},
},
},
}
```