File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,9 @@ func main() {
23
23
config.Addr = " your-hostname:your-port"
24
24
25
25
dumpDir := " dumps" // you should create this directory
26
- dumpFilenameFormat := fmt.Sprintf (" %s -20060102T150405" , dbname ) // accepts time layout string and add .sql at the end of file
26
+ dumpFilenameFormat := fmt.Sprintf (" %s -20060102T150405" , config. DBName ) // accepts time layout string and add .sql at the end of file
27
27
28
- db , err := sql.Open (" mysql" , config.FormatDNS ())
28
+ db , err := sql.Open (" mysql" , config.FormatDSN ())
29
29
if err != nil {
30
30
fmt.Println (" Error opening database: " , err)
31
31
return
@@ -39,12 +39,12 @@ func main() {
39
39
}
40
40
41
41
// Dump database to file
42
- resultFilename , err := dumper.Dump ()
42
+ err := dumper.Dump ()
43
43
if err != nil {
44
44
fmt.Println (" Error dumping:" , err)
45
45
return
46
46
}
47
- fmt.Printf (" File is saved to %s " , resultFilename )
47
+ fmt.Printf (" File is saved to %s " , dumpFilenameFormat )
48
48
49
49
// Close dumper, connected database and file stream.
50
50
dumper.Close ()
You can’t perform that action at this time.
0 commit comments