// OpenBoltDB creates and opens a database at the given path. If the file
// does not exist then it will be created automatically.
//
// Timeout is the amount of time to wait to obtain a file lock. When set
// to zero it will wait indefinitely. This option is only available on
// Darwin and Linux.
OpenBoltDB creates and opens a database at the given path. If the file
does not exist then it will be created automatically.

Timeout is the amount of time to wait to obtain a file lock. When set
to zero it will wait indefinitely. This option is only available on
Darwin and Linux.
// OpenBoltDB creates and opens a database at the given path . If the file // does not exist then it will be created automatically . // // Timeout is the amount of time to wait to obtain a file lock . When set // to zero it will wait indefinitely . This option is only available on // Darwin and Linux .
func OpenBoltDB(path string, timeout time.Duration) (*BoltDB, error) {
	tree, err := bolt.Open(path, defaultOpenMode, &bolt.Options{
		Timeout: timeout,
	})
	if err != nil {
		return nil, err
	}
	if err = tree.Update(func(tx *bolt.Tx) (err error) {
		_, err = tx.CreateBucketIfNotExists(rootBucket)
		return err
	}); err != nil {
		return nil, errors.New("create root: " + err.Error())
	}
	return &BoltDB{tree: tree}, nil
}
func OpenBoltDB ( path string , timeout time . Duration ) ( * BoltDB , error ) { tree , err := bolt . Open ( path , defaultOpenMode , & bolt . Options { Timeout : timeout , } ) if err != nil { return nil , err } if err = tree . Update ( func ( tx * bolt . Tx ) ( err error ) { _ , err = tx . CreateBucketIfNotExists ( rootBucket ) return err } ) ; err != nil { return nil , errors . New ( " " + err . Error ( ) ) } return & BoltDB { tree : tree } , nil }
OpenBoltDB creates and opens a database at the given path.
OpenBoltDB creates and opens a database at the given path .