code: func (tr *Transaction) Write(b *Batch, wo *opt.WriteOptions) error {
  	if b == nil || b.Len() == 0 {
  		return nil
  	}
  
  	tr.lk.Lock()
  	defer tr.lk.Unlock()
  	if tr.closed {
  		return errTransactionDone
  	}
  	return b.replayInternal(func(i int, kt keyType, k, v []byte) error {
  		return tr.put(kt, k, v)
  	})
  }
docs: // Write apply the given batch to the transaction. The batch will be applied
  // sequentially.
  // Please note that the transaction is not compacted until committed, so if you
  // writes 10 same keys, then those 10 same keys are in the transaction.
  //
  // It is safe to modify the contents of the arguments after Write returns.