code: func (db *DB) Begin(writable bool) (*Tx, error) {
  	tx := &Tx{
  		db:       db,
  		writable: writable,
  	}
  	tx.lock()
  	if db.closed {
  		tx.unlock()
  		return nil, ErrDatabaseClosed
  	}
  	if writable {
  		// writable transactions have a writeContext object that
  		// contains information about changes to the database.
  		tx.wc = &txWriteContext{}
  		tx.wc.rollbackItems = make(map[string]*dbItem)
  		tx.wc.rollbackIndexes = make(map[string]*index)
  		if db.persist {
  			tx.wc.commitItems = make(map[string]*dbItem)
  		}
  	}
  	return tx, nil
  }
docs: // Begin opens a new transaction.
  // Multiple read-only transactions can be opened at the same time but there can
  // only be one read/write transaction at a time. Attempting to open a read/write
  // transactions while another one is in progress will result in blocking until
  // the current read/write transaction is completed.
  //
  // All transactions must be closed by calling Commit() or Rollback() when done.