You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: delete.go
    path of file: ./repos/chai/internal/stream/table
    
    the code of the file until where you have to start completion: package table

import (
	"fmt"

	"github.com/chaisql/chai/internal/database"
	"github.com/chaisql/chai/internal/environment"
	"github.com/chaisql/chai/internal/stream"
	"github.com/cockroachdb/errors"
)

// A DeleteOperator replaces objects in the table
type DeleteOperator struct {
	stream.BaseOperator
	Name string
}

// Delete deletes rows from the table
    
func (op *DeleteOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error {
	var table *database.Table

	return op.Prev.Iterate(in, func(out *environment.Environment) error {
		if table == nil {
			var err error
			table, err = out.GetTx().Catalog.GetTable(out.GetTx(), op.Name)
			if err != nil {
				return err
			}
		}

		r, ok := out.GetDatabaseRow()
		if !ok {
			return errors.New("missing row")
		}

		err := table.Delete(r.Key())
		if err != nil {
			return err
		}

		return f(out)
	})
}