mirror of
https://github.com/ent/ent.git
synced 2026-04-30 06:30:55 +03:00
go: rename module from github.com/facebook/ent => entgo.io/ent (#1226)
This commit is contained in:
@@ -8,7 +8,7 @@ library using the [external templates](templates.md) option (i.e. it can be exte
|
||||
|
||||
## Quick Introduction
|
||||
|
||||
In order to enable the [`entgql`](https://github.com/facebookincubator/ent-contrib/tree/master/entgql) extension to your
|
||||
In order to enable the [`entgql`](https://entgo.ioincubator/ent-contrib/tree/master/entgql) extension to your
|
||||
project, you need to use the `entc` (ent codegen) package as described [here](code-gen.md#use-entc-as-a-package).
|
||||
Follow these 3 steps to enable it to your project:
|
||||
|
||||
@@ -22,9 +22,9 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/facebook/ent/entc"
|
||||
"github.com/facebook/ent/entc/gen"
|
||||
"github.com/facebookincubator/ent-contrib/entgql"
|
||||
"entgo.io/ent/entc"
|
||||
"entgo.io/ent/entc/gen"
|
||||
"entgo.ioincubator/ent-contrib/entgql"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -46,7 +46,7 @@ package ent
|
||||
```
|
||||
|
||||
Note that `ent/entc.go` is ignored using a build tag, and it's executed by the `go generate` command
|
||||
through the `generate.go` file. The full example can be found in the [ent-contrib repository](https://github.com/facebookincubator/ent-contrib/blob/master/entgql/internal/todo).
|
||||
through the `generate.go` file. The full example can be found in the [ent-contrib repository](https://entgo.ioincubator/ent-contrib/blob/master/entgql/internal/todo).
|
||||
|
||||
|
||||
3\. Run codegen for your ent project:
|
||||
@@ -86,7 +86,7 @@ func (r *queryResolver) Node(ctx context.Context, guid string) (ent.Noder, error
|
||||
|
||||
## GQL Configuration
|
||||
|
||||
Here's a configuration example for a todo app as exists in [ent-contrib/entgql/todo](https://github.com/facebookincubator/ent-contrib/tree/master/entgql/internal/todo).
|
||||
Here's a configuration example for a todo app as exists in [ent-contrib/entgql/todo](https://entgo.ioincubator/ent-contrib/tree/master/entgql/internal/todo).
|
||||
|
||||
```yaml
|
||||
schema:
|
||||
@@ -100,7 +100,7 @@ resolver:
|
||||
# gqlgen will search for any type names in the schema in the generated
|
||||
# ent package. If they match it will use them, otherwise it will new ones.
|
||||
autobind:
|
||||
- github.com/facebookincubator/ent-contrib/entgql/internal/todo/ent
|
||||
- entgo.ioincubator/ent-contrib/entgql/internal/todo/ent
|
||||
|
||||
models:
|
||||
ID:
|
||||
@@ -109,7 +109,7 @@ models:
|
||||
Node:
|
||||
model:
|
||||
# ent.Noder is the new interface generated by the Node template.
|
||||
- github.com/facebookincubator/ent-contrib/entgql/internal/todo/ent.Noder
|
||||
- entgo.ioincubator/ent-contrib/entgql/internal/todo/ent.Noder
|
||||
```
|
||||
|
||||
## Pagination
|
||||
@@ -131,7 +131,7 @@ The ordering option allows us to apply an ordering on the edges returned from a
|
||||
### Example
|
||||
|
||||
Let's go over the steps needed in order to add ordering to an existing GraphQL type.
|
||||
The code example is based on a todo-app that can be found in [ent-contrib/entql/todo](https://github.com/facebookincubator/ent-contrib/tree/master/entgql/internal/todo).
|
||||
The code example is based on a todo-app that can be found in [ent-contrib/entql/todo](https://entgo.ioincubator/ent-contrib/tree/master/entgql/internal/todo).
|
||||
|
||||
### Defining order fields in ent/schema
|
||||
|
||||
@@ -353,12 +353,12 @@ func (mutationResolver) CreateTodo(ctx context.Context, todo TodoInput) (*ent.To
|
||||
|
||||
## Examples
|
||||
|
||||
The [ent-contrib](https://github.com/facebookincubator/ent-contrib) contains several examples at the moment:
|
||||
1. A complete GraphQL server with a simple [Todo App](https://github.com/facebookincubator/ent-contrib/tree/master/entgql/internal/todo) with numeric ID field
|
||||
2. The same [Todo App](https://github.com/facebookincubator/ent-contrib/tree/master/entgql/internal/todouuid) in 1, but with UUID type for the ID field
|
||||
3. The same [Todo App](https://github.com/facebookincubator/ent-contrib/tree/master/entgql/internal/todopulid) in 1 and 2, but with a prefixed [ULID](https://github.com/ulid/spec) or `PULID` as the ID field. This example supports the Relay Node API by prefixing IDs with the entity type rather than employing the ID space partitioning in [Universal IDs](migrate.md#universal-ids).
|
||||
The [ent-contrib](https://entgo.ioincubator/ent-contrib) contains several examples at the moment:
|
||||
1. A complete GraphQL server with a simple [Todo App](https://entgo.ioincubator/ent-contrib/tree/master/entgql/internal/todo) with numeric ID field
|
||||
2. The same [Todo App](https://entgo.ioincubator/ent-contrib/tree/master/entgql/internal/todouuid) in 1, but with UUID type for the ID field
|
||||
3. The same [Todo App](https://entgo.ioincubator/ent-contrib/tree/master/entgql/internal/todopulid) in 1 and 2, but with a prefixed [ULID](https://github.com/ulid/spec) or `PULID` as the ID field. This example supports the Relay Node API by prefixing IDs with the entity type rather than employing the ID space partitioning in [Universal IDs](migrate.md#universal-ids).
|
||||
|
||||
---
|
||||
|
||||
Please note that this documentation is under development. All code parts reside in [ent-contrib/entgql](https://github.com/facebookincubator/ent-contrib/tree/master/entgql),
|
||||
and an example of a todo-app can be found in [ent-contrib/entql/todo](https://github.com/facebookincubator/ent-contrib/tree/master/entgql/internal/todo).
|
||||
Please note that this documentation is under development. All code parts reside in [ent-contrib/entgql](https://entgo.ioincubator/ent-contrib/tree/master/entgql),
|
||||
and an example of a todo-app can be found in [ent-contrib/entql/todo](https://entgo.ioincubator/ent-contrib/tree/master/entgql/internal/todo).
|
||||
|
||||
Reference in New Issue
Block a user