Jason Lee 59408390c2 Add db.Transaction method for create Transaction block. (#2767)
* Add `db.Transaction` method for create Transaction block.

example:

```go
func CreateAnimals(db *gorm.DB) error {
  db.Transaction(func(tx *gorm.DB) error {
    if err := tx.Create(&Animal{Name: "Giraffe"}).Error; err != nil {
      // return any error will rollback
      return err
    }

    if err := tx.Create(&Animal{Name: "Lion"}).Error; err != nil {
      return err
    }

    // return nil will commit
    return nil
  })
}
```

* Ensure rollback when commit has error.
2019-11-19 16:08:00 +08:00
2018-02-10 13:55:11 +08:00
2019-05-02 22:49:30 +08:00
2018-11-03 21:55:52 +08:00
2018-02-10 11:07:07 +08:00
2015-01-05 08:59:18 +08:00
2016-03-08 22:00:15 +08:00
2016-01-15 21:16:48 +08:00
2019-04-14 12:30:11 +04:00
2019-05-05 16:23:52 +08:00
2017-03-22 23:50:42 +08:00
2015-03-12 15:50:38 +08:00

GORM

The fantastic ORM library for Golang, aims to be developer friendly.

go report card wercker status codecov Join the chat at https://gitter.im/jinzhu/gorm Open Collective Backer Open Collective Sponsor MIT license GoDoc

Overview

  • Full-Featured ORM (almost)
  • Associations (Has One, Has Many, Belongs To, Many To Many, Polymorphism)
  • Hooks (Before/After Create/Save/Update/Delete/Find)
  • Preloading (eager loading)
  • Transactions
  • Composite Primary Key
  • SQL Builder
  • Auto Migrations
  • Logger
  • Extendable, write Plugins based on GORM callbacks
  • Every feature comes with tests
  • Developer Friendly

Getting Started

Contributing

You can help to deliver a better GORM, check out things you can do

License

© Jinzhu, 2013~time.Now

Released under the MIT License

Description
The fantastic ORM library for Golang, aims to be developer friendly
Readme
Languages
Go 99.9%
Shell 0.1%