parent
ee64beb73b
commit
e410f04aaf
|
@ -363,7 +363,7 @@ return session.Commit()
|
||||||
* Or you can use `Transaction` to replace above codes.
|
* Or you can use `Transaction` to replace above codes.
|
||||||
|
|
||||||
```Go
|
```Go
|
||||||
res, err := engine.Transaction(func(sess *xorm.Session) (interface{}, error) {
|
res, err := engine.Transaction(func(session *xorm.Session) (interface{}, error) {
|
||||||
user1 := Userinfo{Username: "xiaoxiao", Departname: "dev", Alias: "lunny", Created: time.Now()}
|
user1 := Userinfo{Username: "xiaoxiao", Departname: "dev", Alias: "lunny", Created: time.Now()}
|
||||||
if _, err := session.Insert(&user1); err != nil {
|
if _, err := session.Insert(&user1); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -493,4 +493,4 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
||||||
|
|
||||||
## LICENSE
|
## LICENSE
|
||||||
|
|
||||||
BSD License [http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/)
|
BSD License [http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/)
|
||||||
|
|
Loading…
Reference in New Issue