Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghvstcode committed Aug 10, 2020
1 parent 39a12e0 commit efd33da
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# 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.<br/>

- **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.<br/>
- 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/).<br/>
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

If you think you've found a bug, or something isn't behaving the way you think it should, please raise an [issue](https://github.com/99designs/gqlgen/issues) on GitHub.

## 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?
Expand All @@ -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 {
Expand All @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit efd33da

Please sign in to comment.