You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -284,7 +284,8 @@ if err != nil {
284
284
}
285
285
```
286
286
287
-
If our model has relationships, they will be saved (**note:** saved as in insert or update) as well. The relationships of the relationships will not, though. Relationships are only saved with one level of depth.
287
+
If our model has relationships, they will be saved, and so will the relationships of the relationships and so on. TL;DR: inserts are recursive.
288
+
**Note:** the relationships will be saved using `Save`, not `Insert`.
288
289
289
290
```go
290
291
user:=NewUser("foo")
@@ -319,7 +320,8 @@ if err != nil {
319
320
}
320
321
```
321
322
322
-
If our model has relationships, they will be saved (**note:** saved as in insert or update) as well. The relationships of the relationships will not, though. Relationships are only saved with one level of depth.
323
+
If our model has relationships, they will be saved, and so will the relationships of the relationships and so on. TL;DR: updates are recursive.
324
+
**Note:** the relationships will be saved using `Save`, not `Update`.
323
325
324
326
```go
325
327
user:=FindLastPoster()
@@ -346,7 +348,7 @@ if updated {
346
348
}
347
349
```
348
350
349
-
If our model has relationships, they will be saved as well. The relationships of the relationships will not, though. Relationships are only saved with one level of depth.
351
+
If our model has relationships, they will be saved, and so will the relationships of the relationships and so on. TL;DR: saves are recursive.
0 commit comments