doc: change assets path from s3 to entgo.io

This commit is contained in:
Ariel Mashraki
2021-02-17 09:58:03 +02:00
committed by Ariel Mashraki
parent 361663954e
commit b2f6834f67
8 changed files with 27 additions and 27 deletions

View File

@@ -10,7 +10,7 @@ are populated to the `Edges` field in the returned object.
Let's give an example hows does the API look like for the following schema:
![er-group-users](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_user_pets_groups.png)
![er-group-users](https://entgo.io/assets/er_user_pets_groups.png)

View File

@@ -15,7 +15,7 @@ and maintain applications with large data-models and sticks with the following p
<br/>
![gopher-schema-as-code](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/gopher-schema-as-code.png)
![gopher-schema-as-code](https://entgo.io/assets/gopher-schema-as-code.png)
## Installation
@@ -239,7 +239,7 @@ func (Group) Fields() []ent.Field {
Let's define our first relation. An edge from `User` to `Car` defining that a user
can **have 1 or more** cars, but a car **has only one** owner (one-to-many relation).
![er-user-cars](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/re_user_cars.png)
![er-user-cars](https://entgo.io/assets/re_user_cars.png)
Let's add the `"cars"` edge to the `User` schema, and run `go generate ./ent`:
@@ -331,7 +331,7 @@ Assume we have a `Car` object and we want to get its owner; the user that this c
For this, we have another type of edge called "inverse edge" that is defined using the `edge.From`
function.
![er-cars-owner](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/re_cars_owner.png)
![er-cars-owner](https://entgo.io/assets/re_cars_owner.png)
The new edge created in the diagram above is translucent, to emphasize that we don't create another
edge in the database. It's just a back-reference to the real edge (relation).
@@ -392,7 +392,7 @@ func QueryCarUsers(ctx context.Context, a8m *ent.User) error {
We'll continue our example by creating a M2M (many-to-many) relationship between users and groups.
![er-group-users](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/re_group_users.png)
![er-group-users](https://entgo.io/assets/re_group_users.png)
As you can see, each group entity can **have many** users, and a user can **be connected to many** groups;
a simple "many-to-many" relationship. In the above illustration, the `Group` schema is the owner
@@ -449,7 +449,7 @@ go generate ./ent
In order to run our first graph traversal, we need to generate some data (nodes and edges, or in other words,
entities and relations). Let's create the following graph using the framework:
![re-graph](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/re_graph_getting_started.png)
![re-graph](https://entgo.io/assets/re_graph_getting_started.png)
```go

View File

@@ -5,7 +5,7 @@ title: Privacy
The `Policy` option in the schema allows configuring privacy policy for queries and mutations of entities in the database.
![gopher-privacy](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/gopher-privacy-opacity.png)
![gopher-privacy](https://entgo.io/assets/gopher-privacy-opacity.png)
The main advantage of the privacy layer is that, you write the privacy policy **once** (in the schema), and it is **always**
evaluated. No matter where queries and mutations are performed in your codebase, it will always go through the privacy layer.
@@ -24,12 +24,12 @@ in the same order they are declared in the schema.
If all rules are evaluated without returning an error, the evaluation finishes successfully, and the executed operation
gets access to the target nodes.
![privacy-rules](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/permission_1.png)
![privacy-rules](https://entgo.io/assets/permission_1.png)
However, if one of the evaluated rules returns an error or a `privacy.Deny` decision (see below), the executed operation
returns an error, and it is cancelled.
![privacy-deny](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/permission_2.png)
![privacy-deny](https://entgo.io/assets/permission_2.png)
### Privacy Rules
@@ -55,7 +55,7 @@ There are three types of decision that can help you control the privacy rules ev
- `privacy.Skip` - Skip the current rule, and jump to the next privacy rule. This equivalent to returning a `nil` error.
![privacy-allow](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/permission_3.png)
![privacy-allow](https://entgo.io/assets/permission_3.png)
Now, that weve covered the basic terms, lets start writing some code.
@@ -272,7 +272,7 @@ The full example exists in [GitHub](https://github.com/ent/ent/tree/master/examp
In this example, we're going to create a schema with 3 entity types - `Tenant`, `User` and `Group`.
The helper packages `viewer` and `rule` (as mentioned above) also exist in this example to help us structure the application.
![tenant-example](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/tenant_medium.png)
![tenant-example](https://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/ent/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:

View File

@@ -8,7 +8,7 @@ title: Edges
Edges are the relations (or associations) of entities. For example, user's pets, or group's users.
![er-group-users](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_user_pets_groups.png)
![er-group-users](https://entgo.io/assets/er_user_pets_groups.png)
In the example above, you can see 2 relations declared using edges. Let's go over them.
@@ -177,7 +177,7 @@ Let's go over a few examples that show how to define different relation types us
## O2O Two Types
![er-user-card](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_user_card.png)
![er-user-card](https://entgo.io/assets/er_user_card.png)
In this example, a user **has only one** credit-card, and a card **has only one** owner.
@@ -256,7 +256,7 @@ The full example exists in [GitHub](https://github.com/ent/ent/tree/master/examp
## O2O Same Type
![er-linked-list](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_linked_list.png)
![er-linked-list](https://entgo.io/assets/er_linked_list.png)
In this linked-list example, we have a **recursive relation** named `next`/`prev`. Each node in the list can
**have only one** `next` node. If a node A points (using `next`) to node B, B can get its pointer using `prev` (the back-reference edge).
@@ -352,7 +352,7 @@ The full example exists in [GitHub](https://github.com/ent/ent/tree/master/examp
## O2O Bidirectional
![er-user-spouse](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_user_spouse.png)
![er-user-spouse](https://entgo.io/assets/er_user_spouse.png)
In this user-spouse example, we have a **symmetric O2O relation** named `spouse`. Each user can **have only one** spouse.
If user A sets its spouse (using `spouse`) to B, B can get its spouse using the `spouse` edge.
@@ -426,7 +426,7 @@ The full example exists in [GitHub](https://github.com/ent/ent/tree/master/examp
## O2M Two Types
![er-user-pets](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_user_pets.png)
![er-user-pets](https://entgo.io/assets/er_user_pets.png)
In this user-pets example, we have a O2M relation between user and its pets.
Each user **has many** pets, and a pet **has one** owner.
@@ -507,7 +507,7 @@ The full example exists in [GitHub](https://github.com/ent/ent/tree/master/examp
## O2M Same Type
![er-tree](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_tree.png)
![er-tree](https://entgo.io/assets/er_tree.png)
In this example, we have a recursive O2M relation between tree's nodes and their children (or their parent).
Each node in the tree **has many** children, and **has one** parent. If node A adds B to its children,
@@ -616,7 +616,7 @@ The full example exists in [GitHub](https://github.com/ent/ent/tree/master/examp
## M2M Two Types
![er-user-groups](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_user_groups.png)
![er-user-groups](https://entgo.io/assets/er_user_groups.png)
In this groups-users example, we have a M2M relation between groups and their users.
Each group **has many** users, and each user can be joined to **many** groups.
@@ -708,7 +708,7 @@ The full example exists in [GitHub](https://github.com/ent/ent/tree/master/examp
## M2M Same Type
![er-following-followers](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_following_followers.png)
![er-following-followers](https://entgo.io/assets/er_following_followers.png)
In this following-followers example, we have a M2M relation between users to their followers. Each user
can follow **many** users, and can have **many** followers.
@@ -802,7 +802,7 @@ The full example exists in [GitHub](https://github.com/ent/ent/tree/master/examp
## M2M Bidirectional
![er-user-friends](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_user_friends.png)
![er-user-friends](https://entgo.io/assets/er_user_friends.png)
In this user-friends example, we have a **symmetric M2M relation** named `friends`.
Each user can **have many** friends. If user A becomes a friend of B, B is also a friend of A.

View File

@@ -8,7 +8,7 @@ title: Fields
Fields (or properties) in the schema are the attributes of the node. For example, a `User`
with 4 fields: `age`, `name`, `username` and `created_at`:
![re-fields-properties](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_fields_properties.png)
![re-fields-properties](https://entgo.io/assets/er_fields_properties.png)
Fields are returned from the schema using the `Fields` method. For example:

View File

@@ -49,7 +49,7 @@ func (User) Fields() []ent.Field {
Indexes can be configured on composition of fields and edges. The main use-case
is setting uniqueness on fields under a specific relation. Let's take an example:
![er-city-streets](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_city_streets.png)
![er-city-streets](https://entgo.io/assets/er_city_streets.png)
In the example above, we have a `City` with many `Street`s, and we want to set the
street name to be unique under each city.

View File

@@ -6,7 +6,7 @@ title: Graph Traversal
For the purpose of the example, we'll generate the following graph:
![er-traversal-graph](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_traversal_graph.png)
![er-traversal-graph](https://entgo.io/assets/er_traversal_graph.png)
The first step is to generate the 3 schemas: `Pet`, `User`, `Group`.
@@ -157,7 +157,7 @@ func Gen(ctx context.Context, client *ent.Client) error {
Let's go over a few traversals, and show the code for them:
![er-traversal-graph-gopher](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_traversal_graph_gopher.png)
![er-traversal-graph-gopher](https://entgo.io/assets/er_traversal_graph_gopher.png)
The traversal above starts from a `Group` entity, continues to its `admin` (edge),
continues to its `friends` (edge), gets their `pets` (edge), gets each pet's `friends` (edge),
@@ -186,7 +186,7 @@ func Traverse(ctx context.Context, client *ent.Client) error {
What about the following traversal?
![er-traversal-graph-gopher-query](https://s3.eu-central-1.amazonaws.com/entgo.io/assets/er_traversal_graph_gopher_query.png)
![er-traversal-graph-gopher-query](https://entgo.io/assets/er_traversal_graph_gopher_query.png)
We want to get all pets (entities) that have an `owner` (`edge`) that is a `friend`
(edge) of some group `admin` (edge).

View File

@@ -74,7 +74,7 @@ class HomeSplash extends React.Component {
const ProjectTitle = () => (
<div>
<div className="projectTitleContainer">
<img src="https://s3.eu-central-1.amazonaws.com/entgo.io/assets/logo.png" />
<img src="https://entgo.io/assets/logo.png" />
<div className="projectTitle">
<p>{siteConfig.tagline}</p>
</div>
@@ -115,7 +115,7 @@ class HomeSplash extends React.Component {
</a>
</div>
<div className="gopherGraph">
<img src="https://s3.eu-central-1.amazonaws.com/entgo.io/assets/gopher_graph.png" />
<img src="https://entgo.io/assets/gopher_graph.png" />
</div>
<Features />
</div>