File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ func main() {
8181 UserTable .Query ().Delete (1 , 2 , 3 )
8282
8383 // insert
84- _ = UserTable .Query ().Insert (&User{Name: " han" })
84+ UserTable .Query ().Insert (&User{Name: " han" })
8585
8686 // update users with different names
8787 _ = UserTable .Query ().OnConflictUpdate (&UserTable.Name , &UserTable.Name ).
@@ -92,8 +92,8 @@ func main() {
9292
9393``` go
9494 // query join
95- UserTable .Query ().Join (OrderTable, func (query *orm.Query [*User]) *orm.Query [*User] {
96- return query .Where (&UserTable.Id , &OrderTable.UserId )
95+ UserTable .Query ().Join (OrderTable, func (join *orm.Query [*User]) *orm.Query [*User] {
96+ return join .Where (&UserTable.Id , &OrderTable.UserId )
9797 }).Select (UserTable).Gets ()
9898```
9999
@@ -103,7 +103,7 @@ func main() {
103103 // transaction
104104 _ = UserTable .Query ().Transaction (func (query *orm.Query [*User]) error {
105105 newId := query.Insert (&User{Name: " john" }).LastInsertId // insert
106- // newId := orm.NewQuery(UserTable).UseTx(query.Tx()).Insert(User{Name: "john"}).LastInsertId
106+ // newId := orm.NewQuery(UserTable).UseTx(query.Tx()).Insert(& User{Name: "john"}).LastInsertId
107107 fmt.Println (newId)
108108 return errors.New (" I want rollback" ) // rollback
109109 })
You can’t perform that action at this time.
0 commit comments