all: facebookincubator/ent => facebook/ent (#660)

ent repository is going to be migrated to facebook organization
This commit is contained in:
Ariel Mashraki
2020-08-18 11:05:08 +03:00
committed by GitHub
parent a2990e31af
commit fd0a7f9f02
897 changed files with 3100 additions and 3100 deletions

View File

@@ -49,4 +49,4 @@ func Do(ctx context.Context, client *ent.Client) {
GroupBy(user.FieldName).
Strings(ctx)
}
```
```

View File

@@ -9,7 +9,7 @@ title: Introduction
`entc` run the following command:
```bash
go get github.com/facebookincubator/ent/cmd/entc
go get github.com/facebook/ent/cmd/entc
```
## Initialize A New Schema
@@ -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/facebookincubator/ent/cmd/entc
go get github.com/facebook/ent/cmd/entc
```
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/facebookincubator/ent/cmd/entc generate ./schema
//go:generate go run github.com/facebook/ent/cmd/entc generate ./schema
```
Finally, you can run `go generate ./ent` from the root directory of your project
@@ -123,9 +123,9 @@ package main
import (
"log"
"github.com/facebookincubator/ent/entc"
"github.com/facebookincubator/ent/entc/gen"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebook/ent/entc"
"github.com/facebook/ent/entc/gen"
"github.com/facebook/ent/schema/field"
)
func main() {
@@ -139,7 +139,7 @@ func main() {
}
```
The full example exists in [GitHub](https://github.com/facebookincubator/ent/tree/master/examples/entcpkg).
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/entcpkg).
## Schema Description
@@ -179,4 +179,4 @@ User:
+------+------+---------+---------+----------+--------+----------+
| pets | Pet | false | | O2M | false | true |
+------+------+---------+---------+----------+--------+----------+
```
```

View File

@@ -280,7 +280,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://godoc.org/github.com/facebookincubator/ent#Mutation">`ent.Mutation`<a> interface.
However, all builder types implement the generic <a target="_blank" href="https://godoc.org/github.com/facebook/ent#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:
@@ -325,4 +325,4 @@ func SetName(m SetNamer, name string) {
m.SetName(name)
}
}
```
```

View File

@@ -22,4 +22,4 @@ supported by default by SQLite, and will be added in the future using a [tempora
## Gremlin
Gremlin does not support migration nor indexes, and **<ins>it's considered experimental</ins>**.
Gremlin does not support migration nor indexes, and **<ins>it's considered experimental</ins>**.

View File

@@ -117,4 +117,4 @@ Since a query-builder can load more than one association, it's not possible to l
Therefore, `ent` executes additional queries for loading associations. One query for `M2O/O2M` and `O2O` edges, and
2 queries for loading `M2M` edges.
Note that, we expect to improve this in the next versions of `ent`.
Note that, we expect to improve this in the next versions of `ent`.

View File

@@ -17,7 +17,7 @@ sidebar_label: Quick Introduction
## Installation
```console
go get github.com/facebookincubator/ent/cmd/entc
go get github.com/facebook/ent/cmd/entc
```
After installing `entc` (the code generator for `ent`), you should have it in your `PATH`.
@@ -45,7 +45,7 @@ The command above will generate the schema for `User` under `<project>/ent/schem
package schema
import "github.com/facebookincubator/ent"
import "github.com/facebook/ent"
// User holds the schema definition for the User entity.
type User struct {
@@ -70,8 +70,8 @@ Add 2 fields to the `User` schema:
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
)
@@ -208,8 +208,8 @@ And then we add the rest of the fields manually:
import (
"regexp"
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
)
// Fields of the Car.
@@ -242,8 +242,8 @@ Let's add the `"cars"` edge to the `User` schema, and run `go generate ./ent`:
import (
"log"
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
)
// Edges of the User.
@@ -337,8 +337,8 @@ in the `User` schema, and run `go generate ./ent`.
import (
"log"
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
)
// Edges of the Car.
@@ -398,8 +398,8 @@ relationship named `groups`. Let's define this relationship in our schemas:
import (
"log"
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
)
// Edges of the Group.
@@ -415,8 +415,8 @@ relationship named `groups`. Let's define this relationship in our schemas:
import (
"log"
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
)
// Edges of the User.
@@ -605,4 +605,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/facebookincubator/ent/tree/master/examples/start).
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/start).

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://godoc.org/github.com/facebookincubator/ent#Mutation">`ent.Mutation`<a> interface.
However, all builder types implement the generic <a target="_blank" href="https://godoc.org/github.com/facebook/ent#Mutation">`ent.Mutation`<a> interface.
## Hooks
Hooks are functions that get an <a target="_blank" href="https://godoc.org/github.com/facebookincubator/ent#Mutator">`ent.Mutator`<a> and return a mutator back.
Hooks are functions that get an <a target="_blank" href="https://godoc.org/github.com/facebook/ent#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
@@ -151,7 +151,7 @@ import (
gen "<project>/ent"
"<project>/ent/hook"
"github.com/facebookincubator/ent"
"github.com/facebook/ent"
)
// Card holds the schema definition for the CreditCard entity.
@@ -201,4 +201,4 @@ executes `f(g(h(...)))` on mutations.
Also note, that **runtime hooks** are called before **schema hooks**. That is, if `g`,
and `h` were defined in the schema, and `f` was registered using `client.Use(...)`,
they will be executed as follows: `f(g(h(...)))`.
they will be executed as follows: `f(g(h(...)))`.

View File

@@ -173,4 +173,4 @@ func main() {
log.Fatalf("failed printing schema changes: %v", err)
}
}
```
```

View File

@@ -34,4 +34,4 @@ users, err := client.User.
users, err := client.User.Query().
Order(ent.Asc(user.FieldName)).
All(ctx)
```
```

View File

@@ -90,4 +90,4 @@ pets := client.Pet.
s.Where(sql.InInts(pet.OwnerColumn, 1, 2, 3))
})).
AllX(ctx)
```
```

View File

@@ -11,8 +11,8 @@ A custom table name can be provided for types using the `Table` option as follow
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
)
type User struct {

View File

@@ -18,10 +18,10 @@ Here's an example of a schema:
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebookincubator/ent/schema/index"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
"github.com/facebook/ent/schema/edge"
"github.com/facebook/ent/schema/index"
)
type User struct {

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/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
)
// User schema.
@@ -49,8 +49,8 @@ func (User) Edges() []ent.Edge {
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
)
// Pet holds the schema definition for the Pet entity.
@@ -95,8 +95,8 @@ more widely below.
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
)
// Group schema.
@@ -124,8 +124,8 @@ func (Group) Edges() []ent.Edge {
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebook/ent"
"github.com/facebook/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/facebookincubator/ent/tree/master/examples/o2o2types).
The full example exists in [GitHub](https://github.com/facebook/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/facebookincubator/ent/tree/master/examples/o2orecur).
The full example exists in [GitHub](https://github.com/facebook/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/facebookincubator/ent/tree/master/examples/o2obidi).
The full example exists in [GitHub](https://github.com/facebook/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/facebookincubator/ent/tree/master/examples/o2m2types).
The full example exists in [GitHub](https://github.com/facebook/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/facebookincubator/ent/tree/master/examples/o2mrecur).
The full example exists in [GitHub](https://github.com/facebook/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/facebookincubator/ent/tree/master/examples/m2m2types).
The full example exists in [GitHub](https://github.com/facebook/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/facebookincubator/ent/tree/master/examples/m2mrecur).
The full example exists in [GitHub](https://github.com/facebook/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/facebookincubator/ent/tree/master/examples/m2mbidi).
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/m2mbidi).
## Required
@@ -931,4 +931,4 @@ func (Pet) Edges() []ent.Edge {
}
```
Read more about annotations and their usage in templates in the [template doc](templates.md#annotations).
Read more about annotations and their usage in templates in the [template doc](templates.md#annotations).

View File

@@ -18,8 +18,8 @@ package schema
import (
"time"
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
)
// User schema.
@@ -63,8 +63,8 @@ import (
"time"
"net/url"
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
)
// User schema.
@@ -149,9 +149,9 @@ there is an option to override the default behavior using the `SchemaType` metho
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/dialect"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebook/ent"
"github.com/facebook/ent/dialect"
"github.com/facebook/ent/schema/field"
)
// Card schema.
@@ -177,7 +177,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://godoc.org/github.com/facebookincubator/ent/schema/field#ValueScanner) interface.
[ValueScanner](https://godoc.org/github.com/facebook/ent/schema/field#ValueScanner) interface.
```go
@@ -186,9 +186,9 @@ package schema
import (
"database/sql"
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/dialect"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebook/ent"
"github.com/facebook/ent/dialect"
"github.com/facebook/ent/schema/field"
)
// Amount is a custom Go type that's convertible to the basic float64 type.
@@ -246,8 +246,8 @@ import (
"strings"
"time"
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
)
@@ -521,4 +521,4 @@ func (User) Fields() []ent.Field {
}
```
Read more about annotations and their usage in templates in the [template doc](templates.md#annotations).
Read more about annotations and their usage in templates in the [template doc](templates.md#annotations).

View File

@@ -12,8 +12,8 @@ speed of data retrieval, or defining uniqueness.
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/index"
"github.com/facebook/ent"
"github.com/facebook/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/facebookincubator/ent/tree/master/examples/edgeindex).
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/edgeindex).
## Dialect Support

View File

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

View File

@@ -16,7 +16,7 @@ import (
"time"
"<your_project>/ent"
"github.com/facebookincubator/ent/dialect/sql"
"github.com/facebook/ent/dialect/sql"
)
func Open() (*ent.Client, error) {
@@ -43,7 +43,7 @@ import (
"time"
"<your_project>/ent"
entsql "github.com/facebookincubator/ent/dialect/sql"
entsql "github.com/facebook/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/facebookincubator/ent/dialect/sql"
entsql "github.com/facebook/ent/dialect/sql"
)
type connector struct {
@@ -117,8 +117,8 @@ import (
"<project>/ent"
"github.com/facebookincubator/ent/dialect"
entsql "github.com/facebookincubator/ent/dialect/sql"
"github.com/facebook/ent/dialect"
entsql "github.com/facebook/ent/dialect/sql"
_ "github.com/jackc/pgx/v4/stdlib"
)

View File

@@ -44,7 +44,7 @@ In order to override an existing template, use its name. For example:
## Annotations
Schema annotations allow to attach 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://godoc.org/github.com/facebookincubator/ent/schema/field#Annotation) interface.
and implement the [Annotation](https://godoc.org/github.com/facebook/ent/schema/field#Annotation) interface.
Here's an example of an annotation and its usage in schema and template:
@@ -99,9 +99,9 @@ func (User) Fields() []ent.Field {
## Examples
A custom template for implementing the `Node` API for GraphQL -
[Github](https://github.com/facebookincubator/ent/blob/master/entc/integration/template/ent/template/node.tmpl).
[Github](https://github.com/facebook/ent/blob/master/entc/integration/template/ent/template/node.tmpl).
## 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://godoc.org/github.com/facebookincubator/ent/entc/gen">GoDoc<a>.
documentation, see the <a target="_blank" href="https://godoc.org/github.com/facebook/ent/entc/gen">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/facebookincubator/ent/tree/master/examples/traversal).
The full example exists in [GitHub](https://github.com/facebook/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/facebookincubator/ent/tree/master/examples/traversal).
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/traversal).
## Best Practices

View File

@@ -211,4 +211,4 @@ func Traverse(ctx context.Context, client *ent.Client) error {
}
```
The full example exists in [GitHub](https://github.com/facebookincubator/ent/tree/master/examples/traversal).
The full example exists in [GitHub](https://github.com/facebook/ent/tree/master/examples/traversal).

View File

@@ -47,4 +47,4 @@ schema configuration is verified by **entc** (the ent codegen) that generates an
statically-typed API that keeps Go developers productive and happy.
It supports MySQL, SQLite (mainly for testing) and Gremlin. PostgreSQL will be added soon.
Were open-sourcing **ent** today, and invite you to get started → [entgo.io/docs/getting-started](/docs/getting-started).
Were open-sourcing **ent** today, and invite you to get started → [entgo.io/docs/getting-started](/docs/getting-started).

View File

@@ -30,15 +30,15 @@ const siteConfig = {
// Used for publishing and more
projectName: 'ent',
organizationName: 'facebookincubator',
organizationName: 'facebook',
customDocsPath: 'md',
// For no header links in the top nav bar -> headerLinks: [],
headerLinks: [
{doc: 'getting-started', label: 'Docs'},
{href: 'https://godoc.org/github.com/facebookincubator/ent', label: 'GoDoc'},
{href: 'https://github.com/facebookincubator/ent', label: 'Github'},
{href: 'https://godoc.org/github.com/facebook/ent', label: 'GoDoc'},
{href: 'https://github.com/facebook/ent', label: 'Github'},
{ blog: true, label: 'Blog' },
],