CopyTempFile copies a database to a temporary file.
()
| 193 | |
| 194 | // CopyTempFile copies a database to a temporary file. |
| 195 | func (db *DB) CopyTempFile() { |
| 196 | path := filepath.Join(db.t.TempDir(), "db.copy") |
| 197 | err := db.View(func(tx *bolt.Tx) error { |
| 198 | return tx.CopyFile(path, 0600) |
| 199 | }) |
| 200 | require.NoError(db.t, err) |
| 201 | fmt.Println("db copied to: ", path) |
| 202 | } |
| 203 | |
| 204 | // PrintStats prints the database stats |
| 205 | func (db *DB) PrintStats() { |