#sled-database #key-value-database #sled #cli-tool #migration #settings #import-export

app sledtool

命令行工具,用于查询、修改、导入和导出Sled键值数据库

3个版本

0.1.2 2021年9月19日
0.1.1 2021年9月16日
0.1.0 2021年1月12日

2182数据库接口

每月24次下载

MIT 许可证

23KB
505 代码行

sledtool

用于操作Sled键值数据库的命令行工具。

它可以用于在Sled版本之间或不同的压缩设置之间进行迁移。

Usage: sledtool <dbpath> [-c] [-C <compression-factor>] [-N] [-F] [-L] <command> [<args>]

CLI tool to work with Sled databases

Options:
  -c, --compress    set `use_compression` in `sled::Config` to true
  -C, --compression-factor
                    set `compression_factor` in `sled::Config` to specified
                    value
  -N, --create-new  set `create_new` in `sled::Config` to true, making it a
                    failure to open existing database
  -F, --throughput-mode
                    set `mode` in `sled::Config` to HighThroughput
  -L, --low-space   set `mode` in `sled::Config` to LowSpace
  --help            display usage information

Commands:
  export            Outout entire content of the database to JSON with
                    hex-encoded buffers
  import            Import entire content of the database from JSON with
                    hex-encoded buffers
  get               Get value of specific key (or first/last) from the database
  set               Set value of specific key in the database
  rm                Remove specific key or range of keys
  nop               No operation, just open and close the database
  idle              Open Sled database, then wait indefinitely
  treenames         List tree names
  genid             Generate monotonic ID
  checksum          Call `checksum` and output the result
  sizeondisk        Call `size_on_disk` and output the result

$ sledtool <dbname> get --help
Usage: sledtool get <key> [-t <tree>] [-r] [-R] [-T] [-g] [-l] [-K] [-q] [-f] [-l]

Get value of specific key (or first/last) from the database

Options:
  -t, --tree        tree to use
  -r, --raw-value   inhibit hex-encoding the value
  -R, --raw-key     inhibit hex-decoding or hex-encoding the key
  -T, --raw-tree-name
                    inhibit hex-decoding the tree name
  -g, --gt          use `get_gt` instead of `get`
  -l, --lt          use `get_lt` instead of `get`
  -K, --print-key   print key in addition to the value, with `=` sign in between
  -q, --quiet       do not print `Not found` to console, just set exit code 1
  -f, --first       ignore key, get first record instead
  -l, --last        ignore key, get last record instead
  --help            display usage information
$ sledtool qqq export
{
 "5f5f736c65645f5f64656661756c74":{
  "71717132": "71776572747961736466"
 }
}

另请参阅

依赖关系

~2.1–4MB
~70K SLoC