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: dump.go
    path of file: ./repos/chai/cmd/chai/dbutil
    
    the code of the file until where you have to start completion: package dbutil

import (
	"fmt"
	"io"
	"strings"

	"github.com/chaisql/chai"
	"go.uber.org/multierr"
)

// Dump takes a database and dumps its content as SQL queries in the given writer.
// If tables is provided, only selected tables will be outputted.
func Dump(db *chai.DB, w io.Writer, tables ...string) error {
	conn, err := db.Connect()
	if err != nil {
		return err
	}
	defer conn.Close()

	tx, err := conn.Begin(false)
	if err != nil {
		return err
	}
	defer tx.Rollback()

	if _, err = fmt.Fprintln(w, "BEGIN TRANSACTION;"); err != nil {
		return err
	}

	i := 0
	err = QueryTables(tx, tables, func(name, query string) error {
		// Blank separ
    
func Dump(db *chai.DB, w io.Writer, tables ...string) error {
	conn, err := db.Connect()
	if err != nil {
		return err
	}
	defer conn.Close()

	tx, err := conn.Begin(false)
	if err != nil {
		return err
	}
	defer tx.Rollback()

	if _, err = fmt.Fprintln(w, "BEGIN TRANSACTION;"); err != nil {
		return err
	}

	i := 0
	err = QueryTables(tx, tables, func(name, query string) error {
		// Blank separation between tables.
		if i > 0 {
			if _, err := fmt.Fprintln(w, ""); err != nil {
				return err
			}
		}
		i++

		return dumpTable(tx, w, query, name)
	})
	if err != nil {
		_, er := fmt.Fprintln(w, "ROLLBACK;")
		return multierr.Append(err, er)
	}

	_, err = fmt.Fprintln(w, "COMMIT;")
	return err
}