bbolt/bolt.go
Ben Johnson a47c50295a Add bolt.Open().
Per the suggestion of @tv42 and @cespare, this commit adds a package level
function to create and initialize a database at a given path. This is
a common interface for database packages.
2014-02-26 16:32:40 -07:00

16 lines
310 B
Go

package bolt
import (
"os"
)
// Open creates and opens a database at the given path.
// If the file does not exist then it will be created automatically.
func Open(path string, mode os.FileMode) (*DB, error) {
db := &DB{}
if err := db.Open(path, mode); err != nil {
return nil, err
}
return db, nil
}