From efd33dab01483cfa54d634690aea67ab914dd72a Mon Sep 17 00:00:00 2001 From: Ghvst Code Date: Mon, 10 Aug 2020 17:51:45 +0100 Subject: [PATCH] Update README.md --- README.md | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ac474f1947..1b00319e48 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,24 @@ # gqlgen [![Continuous Integration](https://github.com/99designs/gqlgen/workflows/Continuous%20Integration/badge.svg)](https://github.com/99designs/gqlgen/actions) [![Read the Docs](https://badgen.net/badge/docs/available/green)](http://gqlgen.com/) [![GoDoc](https://godoc.org/github.com/99designs/gqlgen?status.svg)](https://godoc.org/github.com/99designs/gqlgen) +![gqlgen](https://user-images.githubusercontent.com/46195831/89802919-0bb8ef00-db2a-11ea-8ba4-88e7a58b2fd2.png) + ## What is gqlgen? -[gqlgen](https://github.com/99designs/gqlgen) is a Go library for building GraphQL servers without any fuss. gqlgen is: +[gqlgen](https://github.com/99designs/gqlgen) is a Go library for building GraphQL servers without any fuss.
-- **Schema first** — Define your API using the GraphQL [Schema Definition Language](http://graphql.org/learn/schema/). -- **Type safe** — You should never see `map[string]interface{}` here. -- **Codegen** — Let us generate the boring bits, so you can build your app quickly. +- **gqlgen is based on a Schema first approach** — You get to Define your API using the GraphQL [Schema Definition Language](http://graphql.org/learn/schema/). +- **gqlgen priortizes Type safety** — You should never see `map[string]interface{}` here. +- **gqlgen enables Codegen** — We generate the boring bits, so you can focus on building your app quickly. -[Feature Comparison](https://gqlgen.com/feature-comparison/) +Still not convinced enough to use **gqlgen**? Compare **gqlgen** with other Go graphql [implementations](https://gqlgen.com/feature-comparison/) ## Getting Started +- To install gqlgen run the comand `go get github.com/99designs/gqlgen` in your project directory.
+- You could initialize a new project using the recommended folder structure by running this command `go run github.com/99designs/gqlgen init`. -First work your way through the [Getting Started](https://gqlgen.com/getting-started/) tutorial. - -If you can't find what your looking for, look at our [examples](https://github.com/99designs/gqlgen/tree/master/example) for example usage of gqlgen, or visit [godoc](https://godoc.org/github.com/99designs/gqlgen). +You could find a more comprehensive guide to help you get started [here](https://gqlgen.com/getting-started/).
+We also have a couple of real-world [examples](https://github.com/99designs/gqlgen/tree/master/example) to help you create GraphQL applicatons seamlessly, +You can see the [examples](https://github.com/99designs/gqlgen/tree/master/example) here or visit [godoc](https://godoc.org/github.com/99designs/gqlgen). ## Reporting Issues @@ -22,8 +26,7 @@ If you think you've found a bug, or something isn't behaving the way you think i ## Contributing -Read our [Contribution Guidelines](https://github.com/99designs/gqlgen/blob/master/CONTRIBUTING.md) for information on how you can help out gqlgen. - +We welcome contributions, Read our [Contribution Guidelines](https://github.com/99designs/gqlgen/blob/master/CONTRIBUTING.md) to learn more about contributing to **gqlgen** ## Frequently asked questions ### How do I prevent fetching child objects that might not be used? @@ -38,11 +41,11 @@ type User { } ``` -You need to tell gqlgen that we should only fetch friends if the user requested it. There are two ways to do this. +You need to tell gqlgen that it should only fetch friends if the user requested it. There are two ways to do this; -#### Custom Models +- #### Using Custom Models -Write a custom model that omits the Friends model: +Write a custom model that omits the friends field: ```go type User struct { @@ -60,9 +63,9 @@ models: model: github.com/you/pkg/model.User # go import path to the User struct above ``` -#### Explicit Resolvers +- #### Using Explicit Resolvers -If you want to Keep using the generated model: mark the field as requiring a resolver explicitly in `gqlgen.yml`: +If you want to Keep using the generated model, mark the field as requiring a resolver explicitly in `gqlgen.yml` like this: ```yaml # gqlgen.yml @@ -82,9 +85,9 @@ func (r *userResolver) Friends(ctx context.Context, obj *User) ([]*User, error) } ``` -### IDs are strings but I like ints, why cant I have ints? +### Can I change the type of the ID from type Strings to Type Int? -You can by remapping it in config: +Yes! You can by remapping it in config as seen below: ```yaml models: