go: rename module from github.com/facebook/ent => entgo.io/ent (#1226)

This commit is contained in:
Ariel Mashraki
2021-02-02 23:03:04 +02:00
committed by GitHub
parent 7a2173f20d
commit dd4792f5b3
1087 changed files with 3956 additions and 3956 deletions

View File

@@ -9,7 +9,7 @@ The project comes with a codegen tool called `ent`. In order to install
`ent` run the following command:
```bash
go get github.com/facebook/ent/cmd/ent
go get entgo.io/ent/cmd/ent
```
## Initialize A New Schema
@@ -17,7 +17,7 @@ go get github.com/facebook/ent/cmd/ent
In order to generate one or more schema templates, run `ent init` as follows:
```bash
go run github.com/facebook/ent/cmd/ent init User Pet
go run entgo.io/ent/cmd/ent init User Pet
```
`init` will create the 2 schemas (`user.go` and `pet.go`) under the `ent/schema` directory.
@@ -59,7 +59,7 @@ go mod init <project>
And then, re-run the following command in order to add `ent` to your `go.mod` file:
```console
go get github.com/facebook/ent/cmd/ent
go get entgo.io/ent/cmd/ent
```
Add a `generate.go` file to your project under `<project>/ent`:
@@ -67,7 +67,7 @@ Add a `generate.go` file to your project under `<project>/ent`:
```go
package ent
//go:generate go run github.com/facebook/ent/cmd/ent generate ./schema
//go:generate go run entgo.io/ent/cmd/ent generate ./schema
```
Finally, you can run `go generate ./ent` from the root directory of your project
@@ -109,7 +109,7 @@ a file with the same name as the template. The flag format supports `file`, `di
as follows:
```console
go run github.com/facebook/ent/cmd/ent generate --template <dir-path> --template glob="path/to/*.tmpl" ./ent/schema
go run entgo.io/ent/cmd/ent generate --template <dir-path> --template glob="path/to/*.tmpl" ./ent/schema
```
More information and examples can be found in the [external templates doc](templates.md).
@@ -124,9 +124,9 @@ package main
import (
"log"
"github.com/facebook/ent/entc"
"github.com/facebook/ent/entc/gen"
"github.com/facebook/ent/schema/field"
"entgo.io/ent/entc"
"entgo.io/ent/entc/gen"
"entgo.io/ent/schema/field"
)
func main() {
@@ -140,7 +140,7 @@ func main() {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/entcpkg).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/entcpkg).
## Schema Description
@@ -148,7 +148,7 @@ The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/
In order to get a description of your graph schema, run:
```bash
go run github.com/facebook/ent/cmd/ent describe ./ent/schema
go run entgo.io/ent/cmd/ent describe ./ent/schema
```
An example for the output is as follows:
@@ -198,8 +198,8 @@ import (
"log"
"reflect"
"github.com/facebook/ent/entc"
"github.com/facebook/ent/entc/gen"
"entgo.io/ent/entc"
"entgo.io/ent/entc/gen"
)
func main() {

View File

@@ -295,7 +295,7 @@ _, err := client.File.
Each generated node type has its own type of mutation. For example, all [`User` builders](crud.md#create-an-entity), share
the same generated `UserMutation` object.
However, all builder types implement the generic <a target="_blank" href="https://pkg.go.dev/github.com/facebook/ent?tab=doc#Mutation">`ent.Mutation`<a> interface.
However, all builder types implement the generic <a target="_blank" href="https://pkg.go.dev/entgo.io/ent?tab=doc#Mutation">`ent.Mutation`<a> interface.
For example, in order to write a generic code that apply a set of methods on both `ent.UserCreate`
and `ent.UserUpdate`, use the `UserMutation` object:

View File

@@ -88,7 +88,7 @@ func VersionHook() ent.Hook {
The preferred way for writing such an extension is to use [ent.Mixin](schema-mixin.md). Use the `Fields` option for
setting the fields that are shared between all schemas that import the mixed-schema, and use the `Hooks` option for
attaching a mutation-hook for all mutations that are being applied on these schemas. Here's an example, based on a
discussion in the [repository issue-tracker](https://github.com/facebook/ent/issues/830):
discussion in the [repository issue-tracker](https://entgo.io/ent/issues/830):
```go
// AuditMixin implements the ent.Mixin for sharing
@@ -182,7 +182,7 @@ users := client.User.
```
For more examples, go to the [predicates](predicates.md#custom-predicates) page, or search in the repository
issue-tracker for more advance examples like [issue-842](https://github.com/facebook/ent/issues/842#issuecomment-707896368).
issue-tracker for more advance examples like [issue-842](https://entgo.io/ent/issues/842#issuecomment-707896368).
#### How to add custom predicates to the codegen assets?

View File

@@ -13,7 +13,7 @@ Feature flags can be provided either by CLI flags or as arguments to the `gen` p
#### CLI
```console
go run github.com/facebook/ent/cmd/ent generate --feature privacy,entql ./ent/schema
go run entgo.io/ent/cmd/ent generate --feature privacy,entql ./ent/schema
```
#### Go
@@ -27,8 +27,8 @@ import (
"log"
"text/template"
"github.com/facebook/ent/entc"
"github.com/facebook/ent/entc/gen"
"entgo.io/ent/entc"
"entgo.io/ent/entc/gen"
)
func main() {
@@ -71,7 +71,7 @@ The `schema/snapshot` option tells `entc` (ent codegen) to store a snapshot of t
and use it to automatically solve merge conflicts when user's schema can't be built.
This option can be added to projects using the `--feature schema/snapshot` flag, but please see
[facebook/ent/issues/852](https://github.com/facebook/ent/issues/852) to get more context about it.
[facebook/ent/issues/852](https://entgo.io/ent/issues/852) to get more context about it.
#### Schema Config

View File

@@ -20,11 +20,11 @@ and maintain applications with large data-models and sticks with the following p
## Installation
```console
go get github.com/facebook/ent/cmd/ent
go get entgo.io/ent/cmd/ent
```
After installing `ent` codegen tool, you should have it in your `PATH`.
If you don't find it your path, you can also run: `go run github.com/facebook/ent/cmd/ent <command>`
If you don't find it your path, you can also run: `go run entgo.io/ent/cmd/ent <command>`
## Setup A Go Environment
@@ -49,7 +49,7 @@ The command above will generate the schema for `User` under `<project>/ent/schem
package schema
import "github.com/facebook/ent"
import "entgo.io/ent"
// User holds the schema definition for the User entity.
type User struct {
@@ -74,8 +74,8 @@ Add 2 fields to the `User` schema:
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
"entgo.io/ent"
"entgo.io/ent/schema/field"
)
@@ -205,7 +205,7 @@ Let's create 2 additional entities named `Car` and `Group` with a few fields. We
to generate the initial schemas:
```console
go run github.com/facebook/ent/cmd/ent init Car Group
go run entgo.io/ent/cmd/ent init Car Group
```
And then we add the rest of the fields manually:
@@ -213,8 +213,8 @@ And then we add the rest of the fields manually:
import (
"regexp"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
"entgo.io/ent"
"entgo.io/ent/schema/field"
)
// Fields of the Car.
@@ -247,8 +247,8 @@ Let's add the `"cars"` edge to the `User` schema, and run `go generate ./ent`:
import (
"log"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
)
// Edges of the User.
@@ -342,8 +342,8 @@ in the `User` schema, and run `go generate ./ent`.
import (
"log"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
)
// Edges of the Car.
@@ -403,8 +403,8 @@ relationship named `groups`. Let's define this relationship in our schemas:
import (
"log"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
)
// Edges of the Group.
@@ -420,8 +420,8 @@ relationship named `groups`. Let's define this relationship in our schemas:
import (
"log"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
)
// Edges of the User.
@@ -610,4 +610,4 @@ Now when we have a graph with data, we can run a few queries on it:
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/start).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/start).

View File

@@ -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).

View File

@@ -21,11 +21,11 @@ There are 5 types of mutations:
Each generated node type has its own type of mutation. For example, all [`User` builders](crud.md#create-an-entity), share
the same generated `UserMutation` object.
However, all builder types implement the generic <a target="_blank" href="https://pkg.go.dev/github.com/facebook/ent?tab=doc#Mutation">`ent.Mutation`<a> interface.
However, all builder types implement the generic <a target="_blank" href="https://pkg.go.dev/entgo.io/ent?tab=doc#Mutation">`ent.Mutation`<a> interface.
## Hooks
Hooks are functions that get an <a target="_blank" href="https://pkg.go.dev/github.com/facebook/ent?tab=doc#Mutator">`ent.Mutator`<a> and return a mutator back.
Hooks are functions that get an <a target="_blank" href="https://pkg.go.dev/entgo.io/ent?tab=doc#Mutator">`ent.Mutator`<a> and return a mutator back.
They function as middleware between mutators. It's similar to the popular HTTP middleware pattern.
```go
@@ -155,7 +155,7 @@ import (
gen "<project>/ent"
"<project>/ent/hook"
"github.com/facebook/ent"
"entgo.io/ent"
)
// Card holds the schema definition for the CreditCard entity.
@@ -221,8 +221,8 @@ import (
"<project>/ent/hook"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/mixin"
"entgo.io/ent"
"entgo.io/ent/schema/mixin"
)

View File

@@ -231,7 +231,7 @@ import (
"<project>/ent"
"<project>/ent/migrate"
"github.com/facebook/ent/dialect/sql/schema"
"entgo.io/ent/dialect/sql/schema"
)
func main() {

View File

@@ -68,7 +68,7 @@ In order to enable the privacy option in your code generation, enable the `priva
```go
package ent
//go:generate go run github.com/facebook/ent/cmd/ent generate --feature privacy ./schema
//go:generate go run entgo.io/ent/cmd/ent generate --feature privacy ./schema
```
It is recommended to add the [`schema/snapshot`](features.md#auto-solve-merge-conflicts) feature-flag along with the
@@ -89,9 +89,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() {
@@ -132,8 +132,8 @@ After running the code-generation (with the feature-flag for privacy), we add th
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/examples/privacyadmin/ent/privacy"
"entgo.io/ent"
"entgo.io/ent/examples/privacyadmin/ent/privacy"
)
// User holds the schema definition for the User entity.
@@ -165,8 +165,8 @@ package rule
import (
"context"
"github.com/facebook/ent/examples/privacyadmin/ent/privacy"
"github.com/facebook/ent/examples/privacyadmin/viewer"
"entgo.io/ent/examples/privacyadmin/ent/privacy"
"entgo.io/ent/examples/privacyadmin/viewer"
)
// DenyIfNoViewer is a rule that returns Deny decision if the viewer is
@@ -264,7 +264,7 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/privacyadmin).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/privacyadmin).
### Multi Tenancy
@@ -273,7 +273,7 @@ The helper packages `viewer` and `rule` (as mentioned above) also exist in this
![tenant-example](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/tenant_medium.png)
Let's start building this application piece by piece. We begin by creating 3 different schemas (see the full code [here](https://github.com/facebook/ent/tree/master/examples/privacytenant/ent/schema)),
Let's start building this application piece by piece. We begin by creating 3 different schemas (see the full code [here](https://entgo.io/ent/tree/master/examples/privacytenant/ent/schema)),
and since we want to share some logic between them, we create another [mixed-in schema](schema-mixin.md) and add it to all other schemas as follows:
```go
@@ -562,6 +562,6 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/privacytenant).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/privacytenant).
Please note that this documentation is under active development.
Please note that this documentation is under active development.

View File

@@ -5,7 +5,7 @@ title: Annotations
Schema annotations allow attaching metadata to schema objects like fields and edges and inject them to external templates.
An annotation must be a Go type that is serializable to JSON raw value (e.g. struct, map or slice)
and implement the [Annotation](https://pkg.go.dev/github.com/facebook/ent/schema?tab=doc#Annotation) interface.
and implement the [Annotation](https://pkg.go.dev/entgo.io/ent/schema?tab=doc#Annotation) interface.
The builtin annotations allow configuring the different storage drivers (like SQL) and control the code generation output.
@@ -17,10 +17,10 @@ A custom table name can be provided for types using the `entsql` annotation as f
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/dialect/entsql"
"github.com/facebook/ent/schema"
"github.com/facebook/ent/schema/field"
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
)
// User holds the schema definition for the User entity.

View File

@@ -18,10 +18,10 @@ Here's an example of a schema:
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
"github.com/facebook/ent/schema/edge"
"github.com/facebook/ent/schema/index"
"entgo.io/ent"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/index"
)
type User struct {
@@ -56,7 +56,7 @@ Entity schemas are usually stored inside `ent/schema` directory under
the root directory of your project, and can be generated by `entc` as follows:
```console
go run github.com/facebook/ent/cmd/ent init User Group
go run entgo.io/ent/cmd/ent init User Group
```
## It's Just Another ORM

View File

@@ -19,8 +19,8 @@ In the example above, you can see 2 relations declared using edges. Let's go ove
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
)
// User schema.
@@ -49,8 +49,8 @@ func (User) Edges() []ent.Edge {
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
)
// Pet holds the schema definition for the Pet entity.
@@ -95,8 +95,8 @@ more widely below.
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
)
// Group schema.
@@ -124,8 +124,8 @@ func (Group) Edges() []ent.Edge {
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
)
// User schema.
@@ -252,7 +252,7 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/o2o2types).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/o2o2types).
## O2O Same Type
@@ -348,7 +348,7 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/o2orecur).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/o2orecur).
## O2O Bidirectional
@@ -422,7 +422,7 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/o2obidi).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/o2obidi).
## O2M Two Types
@@ -503,7 +503,7 @@ func Do(ctx context.Context, client *ent.Client) error {
return nil
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/o2m2types).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/o2m2types).
## O2M Same Type
@@ -612,7 +612,7 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/o2mrecur).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/o2mrecur).
## M2M Two Types
@@ -704,7 +704,7 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/m2m2types).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/m2m2types).
## M2M Same Type
@@ -797,7 +797,7 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/m2mrecur).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/m2mrecur).
## M2M Bidirectional
@@ -860,7 +860,7 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/m2mbidi).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/m2mbidi).
## Required

View File

@@ -18,8 +18,8 @@ package schema
import (
"time"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
"entgo.io/ent"
"entgo.io/ent/schema/field"
)
// User schema.
@@ -66,8 +66,8 @@ import (
"net/url"
"github.com/google/uuid"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
"entgo.io/ent"
"entgo.io/ent/schema/field"
)
// User schema.
@@ -172,9 +172,9 @@ there is an option to override the default behavior using the `SchemaType` metho
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/dialect"
"github.com/facebook/ent/schema/field"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/schema/field"
)
// Card schema.
@@ -200,7 +200,7 @@ and for time fields, the type is `time.Time`. The `GoType` method provides an op
default ent type with a custom one.
The custom type must be either a type that is convertible to the Go basic type, or a type that implements the
[ValueScanner](https://pkg.go.dev/github.com/facebook/ent/schema/field?tab=doc#ValueScanner) interface.
[ValueScanner](https://pkg.go.dev/entgo.io/ent/schema/field?tab=doc#ValueScanner) interface.
```go
@@ -209,9 +209,9 @@ package schema
import (
"database/sql"
"github.com/facebook/ent"
"github.com/facebook/ent/dialect"
"github.com/facebook/ent/schema/field"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/schema/field"
)
// Amount is a custom Go type that's convertible to the basic float64 type.
@@ -247,9 +247,9 @@ Examples are a Postgres Range type or Geospatial type
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/dialect"
"github.com/facebook/ent/schema/field"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/schema/field"
"github.com/jackc/pgtype"
)
@@ -312,8 +312,8 @@ import (
"strings"
"time"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
"entgo.io/ent"
"entgo.io/ent/schema/field"
)

View File

@@ -12,8 +12,8 @@ speed of data retrieval, or defining uniqueness.
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/index"
"entgo.io/ent"
"entgo.io/ent/schema/index"
)
// User holds the schema definition for the User entity.
@@ -147,7 +147,7 @@ func Do(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/edgeindex).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/edgeindex).
## Dialect Support

View File

@@ -37,9 +37,9 @@ package schema
import (
"time"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
"github.com/facebook/ent/schema/mixin"
"entgo.io/ent"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/mixin"
)
// -------------------------------------------------
@@ -133,8 +133,8 @@ In order to use them, add the `mixin.Time` mixin to your schema as follows:
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/mixin"
"entgo.io/ent"
"entgo.io/ent/schema/mixin"
)
type Pet struct {

View File

@@ -16,7 +16,7 @@ import (
"time"
"<your_project>/ent"
"github.com/facebook/ent/dialect/sql"
"entgo.io/ent/dialect/sql"
)
func Open() (*ent.Client, error) {
@@ -43,7 +43,7 @@ import (
"time"
"<your_project>/ent"
entsql "github.com/facebook/ent/dialect/sql"
entsql "entgo.io/ent/dialect/sql"
)
func Open() (*ent.Client, error) {
@@ -74,7 +74,7 @@ import (
"contrib.go.opencensus.io/integrations/ocsql"
"github.com/go-sql-driver/mysql"
entsql "github.com/facebook/ent/dialect/sql"
entsql "entgo.io/ent/dialect/sql"
)
type connector struct {
@@ -117,8 +117,8 @@ import (
"<project>/ent"
"github.com/facebook/ent/dialect"
entsql "github.com/facebook/ent/dialect/sql"
"entgo.io/ent/dialect"
entsql "entgo.io/ent/dialect/sql"
_ "github.com/jackc/pgx/v4/stdlib"
)

View File

@@ -71,7 +71,7 @@ In order to override an existing template, use its name. For example:
## Annotations
Schema annotations allow attaching metadata to fields and edges and inject them to external templates.
An annotation must be a Go type that is serializable to JSON raw value (e.g. struct, map or slice)
and implement the [Annotation](https://pkg.go.dev/github.com/facebook/ent/schema?tab=doc#Annotation) interface.
and implement the [Annotation](https://pkg.go.dev/entgo.io/ent/schema?tab=doc#Annotation) interface.
Here's an example of an annotation and its usage in schema and template:
@@ -126,12 +126,12 @@ func (User) Fields() []ent.Field {
## Examples
- A custom template for implementing the `Node` API for GraphQL -
[Github](https://github.com/facebook/ent/blob/master/entc/integration/template/ent/template/node.tmpl).
[Github](https://entgo.io/ent/blob/master/entc/integration/template/ent/template/node.tmpl).
- An example for executing external templates with custom functions. See [configuration](https://github.com/facebook/ent/blob/master/examples/entcpkg/ent/entc.go) and its
[README](https://github.com/facebook/ent/blob/master/examples/entcpkg) file.
- An example for executing external templates with custom functions. See [configuration](https://entgo.io/ent/blob/master/examples/entcpkg/ent/entc.go) and its
[README](https://entgo.io/ent/blob/master/examples/entcpkg) file.
## Documentation
Templates are executed on either a specific node-type or the entire schema graph. For API
documentation, see the <a target="_blank" href="https://pkg.go.dev/github.com/facebook/ent/entc/gen?tab=doc">GoDoc<a>.
documentation, see the <a target="_blank" href="https://pkg.go.dev/entgo.io/ent/entc/gen?tab=doc">GoDoc<a>.

View File

@@ -58,7 +58,7 @@ func rollback(tx *ent.Tx, err error) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/traversal).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/traversal).
## Transactional Client
@@ -88,7 +88,7 @@ func Gen(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/traversal).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/traversal).
## Best Practices

View File

@@ -11,7 +11,7 @@ For the purpose of the example, we'll generate the following graph:
The first step is to generate the 3 schemas: `Pet`, `User`, `Group`.
```console
go run github.com/facebook/ent/cmd/ent init Pet User Group
go run entgo.io/ent/cmd/ent init Pet User Group
```
Add the necessary fields and edges for the schemas:
@@ -213,4 +213,4 @@ func Traverse(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/traversal).
The full example exists in [GitHub](https://entgo.io/ent/tree/master/examples/traversal).

View File

@@ -160,7 +160,7 @@ For more information about blog posts, click [here](https://docusaurus.io/docs/e
/* you can add custom pages */
{ page: 'help', label: 'Help' },
/* you can add external links */
{ href: 'https://github.com/facebook/Docusaurus', label: 'GitHub' },
{ href: 'https://entgo.io/Docusaurus', label: 'GitHub' },
...
],
...

View File

@@ -17,7 +17,7 @@ const users = [
// You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/undraw_open_source.svg',
infoLink: 'https://www.facebook.com',
infoLink: 'https://www.faceboo.com',
pinned: true,
},
];
@@ -37,7 +37,7 @@ const siteConfig = {
// For no header links in the top nav bar -> headerLinks: [],
headerLinks: [
{doc: 'getting-started', label: 'Docs'},
{href: 'https://pkg.go.dev/github.com/facebook/ent?tab=doc', label: 'GoDoc'},
{href: 'https://pkg.go.dev/entgo.io/ent?tab=doc', label: 'GoDoc'},
{href: 'https://github.com/facebook/ent', label: 'Github'},
{ blog: true, label: 'Blog' },
],