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: CHANGELOG.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,11 +83,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
83
83
- The mod capability for `orm.Setter` is now reversed. It should now be a mod for Insert and have a method that returns a mod for Update.
84
84
This makes more sense since one would at most use one setter during updates, but can use multiple setters in a bulk insert.
85
85
-`table.InsertQ` has been renamed to `table.Insert`. The old implementation of `Insert` has been removed.
86
-
The same functionality can be achieved by using `modelSlice.Insert()` or creating an `Insert` query using `table.Insert()`.
86
+
The same functionality can be achieved in the following way:
87
+
88
+
```go
89
+
//----------------------------------------------
90
+
// OLD WAY
91
+
//----------------------------------------------
92
+
user, err:= models.Users.Insert(ctx, db, setter) // insert one
93
+
users, err:= models.Users.InsertMany(ctx, db, setters...) // insert many
94
+
95
+
//----------------------------------------------
96
+
// NEW WAY
97
+
//----------------------------------------------
98
+
user, err:= models.Users.Insert(setter).One(ctx, db) // insert one
99
+
users, err:= models.Users.Insert(setters[0], setters[1]).All(ctx, db) // insert many
100
+
101
+
// For cases where you already have a slice of setters and you want to pass them all, you can use `bob.ToMods`
102
+
users, err:= models.Users.Insert(bob.ToMods(setters)).All(ctx, db) // insert many
103
+
```
104
+
87
105
-`table.UpdateQ` has been renamed to `table.Update`. The old implementation of `Update` has been removed.
88
-
The same functionality can be achieved by using `modelSlice.Update()` or creating an `Update` query using `table.Update()`.
106
+
The same functionality can be achieved by using `model.Update()` or `modelSlice.UpdateAll()`.
89
107
-`table.DeleteQ` has been renamed to `table.Delete`. The old implementation of `Delete` has been removed.
90
-
The same functionality can be achieved by using `modelSlice.Delete()` or creating an `Delete` query using `table.Delete()`.
108
+
The same functionality can be achieved by using `modelSlice.DeleteAll()` or creating an `Delete` query using `table.Delete()`.
91
109
-`BeforeInsertHooks` now only takes a single `ModelSetter` at a time.
92
110
This is because it is not possible to know before executing the queries exactly how many setters are being used since additional rows can be inserted by applying another setter as a mod.
93
111
-`bob.Cache()` now requires an `Executor`. This is used to run any query hooks.
0 commit comments