Close closes the database but does NOT delete the underlying file.
()
| 88 | |
| 89 | // Close closes the database but does NOT delete the underlying file. |
| 90 | func (db *DB) Close() error { |
| 91 | if db.DB != nil { |
| 92 | // Log statistics. |
| 93 | if *statsFlag { |
| 94 | db.PrintStats() |
| 95 | } |
| 96 | db.t.Logf("Closing bbolt DB at: %s", db.f) |
| 97 | err := db.DB.Close() |
| 98 | if err != nil { |
| 99 | return err |
| 100 | } |
| 101 | db.DB = nil |
| 102 | } |
| 103 | return nil |
| 104 | } |
| 105 | |
| 106 | // MustClose closes the database but does NOT delete the underlying file. |
| 107 | func (db *DB) MustClose() { |