Categorygithub.com/spacewander/boltcli
modulepackage
0.0.0-20231122055305-7b1e85af4d61
Repository: https://github.com/spacewander/boltcli.git
Documentation: pkg.go.dev

# README

screenshot

Travis GoReportCard codecov.io license

Feature

  • Support CRUD commands on the bucket/key in repl-like command line. You can consider it as redis-cli for boltdb.
  • You can eval Lua script with given database. It makes maintaining boltdb more easily.

Usage

boltcli [-e script] /path/to/db

Commands

Documentation for commands is available with the built-in help command:

/tmp/test.db> help
Commands: buckets, del, delglob, exists, get, help, keys, keyvalues, set, stats
/tmp/test.db> help help
Command: help command

Shows the help output for the given command.

Lua support

You could run a lua script on specific database like this: boltcli -e your.lua db_path. boltcli provides a couple of API within the global variable bolt. For example:

bolt.get("bucket", "key") -- return the value of `key` as a lua string
-- is equal to > get bucket key in the command line

See test.lua as a concrete example.

# Functions

ExecCmdInCli run given cmd with args, return formatted string according to cmd result.
StartCli starts the repl environment.
StartScript evals given script file.

# Variables

No description provided by the author
CmdMap holds the relation between command name and its implement function.
DB is the global boltdb instance which will be inited in the beginning.
DbPath is the path of given db file.

# Type aliases

No description provided by the author