Skip to content

Commit c87ced3

Browse files
committed
io.Closer will close any closable connection
1 parent 06c8b9c commit c87ced3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type metaData struct {
4444
CompleteTime string
4545
}
4646

47-
const version = "0.3.3"
47+
const version = "0.3.4"
4848

4949
const headerTmpl = `-- Go SQL Dump {{ .DumpVersion }}
5050
--

mysqldump.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ func Dump(db *sql.DB, out io.Writer) error {
5353
}
5454

5555
// Close the dumper.
56-
// Will also close the database the dumper is connected to as well as the out stream if it is a *os.File.
56+
// Will also close the database the dumper is connected to as well as the out stream if it has a Close method.
5757
//
5858
// Not required.
5959
func (d *Data) Close() error {
6060
defer func() {
6161
d.Connection = nil
6262
d.Out = nil
6363
}()
64-
if file, ok := d.Out.(*os.File); ok {
65-
file.Close()
64+
if out, ok := d.Out.(io.Closer); ok {
65+
out.Close()
6666
}
6767
return d.Connection.Close()
6868
}

0 commit comments

Comments
 (0)