Bolt database Nushell Plugin
Nushell
Plugin
to interact with bbolt database.
Usage
Plugin implements boltdb command
boltdb {flags} <file> <action> ...(data)
ie to list all the buckets in the "blocks" bucket
boltdb /path/to/bbolt.db buckets -b blocks
See the list of available actions, to see the full help of the command run boltdb --help.
Configuration
Configuration can be provided via $env.config.plugins.NAME Record with following keys:
| key |
default |
description |
| timeout |
3sec |
Timeout for the open database call - only single process at a time may open bbolt database. |
| fileMode |
0600 |
FileMode to use when opening database. |
| ReadOnly |
false |
If set to true databases are opened in read only mode, actions which modify the DB (add, delete, set) would then fail. |
| mustExist |
false |
If set to true database file must exist, otherwise plugin returns error. If both ReadOnly and mustExist are false add and set actions will create the database (if it doesn't exist, other actions still fail). |
See bbolt documentation for more info about these parameters.
Example configuration
Run config env, add
$env.config.plugins = {
boltdb: {
timeout: 5sec,
ReadOnly: true
}
}
save the file and reload the nushell configuration, ie
source $nu.env-path
Installation
Latest version is for Nushell version 0.107.0.
Written in Go using
nu-plugin package.
To install it you have to have Go installed, then run
go install github.com/ainvaltin/nu_plugin_boltdb@latest
This creates the nu_plugin_boltdb binary in your GOBIN directory:
Executables are installed in the directory named by the GOBIN environment
variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH
environment variable is not set.
Locate the binary and follow instructions on
Downloading and installing a plugin
page on how to register nu_plugin_boltdb as a plugin.