name: Transaction

sort: 7

Transaction

ORM has the basic transaction support

  1. o := NewOrm()
  2. err := o.Begin()
  3. // transaction process
  4. ...
  5. ...
  6. // All the query which are using o Ormer in this process are in the transaction
  7. if SomeError {
  8. err = o.Rollback()
  9. } else {
  10. err = o.Commit()
  11. }