diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-26 16:37:22 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-26 16:37:22 -0700 |
commit | 0209ad2ed4d215462f5b91958da495be89eff2c0 (patch) | |
tree | b14c3f9b43c91608a85282ab11c013600633a16c /bolt.go | |
parent | Remove RWTransaction.Bucket(). (diff) | |
parent | Add bolt.Open(). (diff) | |
download | dedo-0209ad2ed4d215462f5b91958da495be89eff2c0.tar.gz dedo-0209ad2ed4d215462f5b91958da495be89eff2c0.tar.xz |
Merge pull request #53 from benbjohnson/open-api
Add bolt.Open()
Diffstat (limited to 'bolt.go')
-rw-r--r-- | bolt.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -0,0 +1,15 @@ +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 +} |