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

import (
	"context"
	"io"
	"os"

	"github.com/chaisql/chai"
	"github.com/cockroachdb/errors"
)

// Restore a database from a file cre
    
func Restore(ctx context.Context, db *chai.DB, dumpFile, dbPath string) error {
	if dbPath == "" {
		return errors.New("database path expected")
	}

	if dumpFile == "" {
		return errors.New("dump file expected")
	}

	file, err := os.Open(dumpFile)
	if err != nil {
		return err
	}
	defer file.Close()

	if db == nil {
		db, err = OpenDB(ctx, dbPath)
		if err != nil {
			return err
		}
		defer db.Close()
	}

	return ExecSQL(ctx, db, file, io.Discard)
}