code: func transaction(db *sql.DB, f func(*sql.Tx) error) (err error) {
  	if db == nil {
  		panic("darwin: sql.DB is nil")
  	}
  
  	tx, err := db.Begin()
  
  	if err != nil {
  		return
  	}
  
  	defer func() {
  		if p := recover(); p != nil {
  			switch p := p.(type) {
  			case error:
  				err = p
  			default:
  				err = fmt.Errorf("%s", p)
  			}
  		}
  		if err != nil {
  			tx.Rollback()
  			return
  		}
  		err = tx.Commit()
  	}()
  
  	return f(tx)
  }
docs: // transaction is a utility function to execute the SQL inside a transaction
  // Panic if db is nil
  // see: http://stackoverflow.com/a/23502629