Skip to content

Commit c0b20c9

Browse files
ObjectBox.iogitbook-bot
authored andcommitted
GitBook: [#104] No subject
1 parent f77bef9 commit c0b20c9

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

.gitbook/assets/many-to-many2.png

21.5 KB
Loading

.gitbook/assets/one-to-many.png

30 KB
Loading

relations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ A 1:N relation is like the example above where a customer can have multiple orde
9494

9595
### One-to-Many (1:N)
9696

97-
![One-to-Many (1:N)](http://objectbox.io/wordpress/wp-content/uploads/2017/02/One-To-Many-2.png)
97+
<figure><img src=".gitbook/assets/one-to-many.png" alt="one to many"><figcaption><p>One-to-Many (1:N)</p></figcaption></figure>
9898

9999
Currently, one-to-many relations are defined implicitly as an opposite relation to a [to-one relation ](relations.md#to-one-relations)as defined above. This is useful for queries, e.g. to select all customers with an order placed within the last seven days.
100100

101101
### Many-to-Many (N:M)
102102

103-
![Many-to-Many (N:M)](http://objectbox.io/wordpress/wp-content/uploads/2017/02/Many-To-Many-2.png)
103+
<figure><img src=".gitbook/assets/many-to-many2.png" alt="many to many"><figcaption><p>Many-to-Many (N:M)</p></figcaption></figure>
104104

105105
To define a to-many relation, you can use a slice of entities - no need to specify the `link` annotation this time because ObjectBox wouldn't know how to store a slice of structs by itself anyway so it assumes it must be a many-to-may relation. They're stored when you put the source entity and loaded when you read it from the database, unless you specify a `lazy` annotation in which case, they're loaded manually, using `Box::GetRelated()`.
106106

0 commit comments

Comments
 (0)