dispatch/storage/init.go
2015-01-17 02:37:21 +01:00

23 lines
359 B
Go

package storage
import (
"github.com/boltdb/bolt"
)
var db *bolt.DB
func init() {
db, _ = bolt.Open("data.db", 0600, nil)
db.Update(func(tx *bolt.Tx) error {
tx.CreateBucketIfNotExists([]byte("Users"))
tx.CreateBucketIfNotExists([]byte("Servers"))
tx.CreateBucketIfNotExists([]byte("Channels"))
return nil
})
}
func Cleanup() {
db.Close()
}