code: func (db *DB) managed(writable bool, fn func(tx *Tx) error) (err error) {
  	var tx *Tx
  	tx, err = db.Begin(writable)
  	if err != nil {
  		return
  	}
  	defer func() {
  		if err != nil {
  			// The caller returned an error. We must rollback.
  			_ = tx.Rollback()
  			return
  		}
  		if writable {
  			// Everything went well. Lets Commit()
  			err = tx.Commit()
  		} else {
  			// read-only transaction can only roll back.
  			err = tx.Rollback()
  		}
  	}()
  	tx.funcd = true
  	defer func() {
  		tx.funcd = false
  	}()
  	err = fn(tx)
  	return
  }
docs: // managed calls a block of code that is fully contained in a transaction.
  // This method is intended to be wrapped by Update and View