diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-08 08:43:18 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-08 08:43:18 -0600 |
commit | 50e04a29aeebe461fe9d00ec780246ac3a222c09 (patch) | |
tree | 6b091583781e60702b46927978f093faf1dcb550 /cmd/bolt/info.go | |
parent | Merge pull request #154 from benbjohnson/inline-buckets (diff) | |
download | dedo-50e04a29aeebe461fe9d00ec780246ac3a222c09.tar.gz dedo-50e04a29aeebe461fe9d00ec780246ac3a222c09.tar.xz |
Add 'bolt info'.
Diffstat (limited to 'cmd/bolt/info.go')
-rw-r--r-- | cmd/bolt/info.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cmd/bolt/info.go b/cmd/bolt/info.go new file mode 100644 index 0000000..1e9e0d8 --- /dev/null +++ b/cmd/bolt/info.go @@ -0,0 +1,26 @@ +package main + +import ( + "os" + + "github.com/boltdb/bolt" +) + +// Info prints basic information about a database. +func Info(path string) { + if _, err := os.Stat(path); os.IsNotExist(err) { + fatal(err) + return + } + + db, err := bolt.Open(path, 0600) + if err != nil { + fatal(err) + return + } + defer db.Close() + + // Print basic database info. + var info = db.Info() + printf("Page Size: %d", info.PageSize) +} |