Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI interaction with sequence number. #910

Open
kuroa-me opened this issue Feb 17, 2025 · 0 comments
Open

CLI interaction with sequence number. #910

kuroa-me opened this issue Feb 17, 2025 · 0 comments

Comments

@kuroa-me
Copy link

I am having some trouble with using the bbolt cli.

Following the bbolt document, I created a few buckets, each of their key was generated by NextSequence(), then serialized by itob(). Using those buckets in code is perfectly fine, but accessing them with the CLI has a bit problem.

For example, the first bucket key has the byte representation of [0 0 0 0 0 0 0 1], it is quite impossible for me to type that in the CLI and have bbolt convert it back the correct way. e.g.

bbolt keys 00000001 -> [48 48 48 48 48 48 48 49]
bbolt keys \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001 -> [117 48 48 48 48 117 48 48 48 48 117 48 48 48 48 117 48 48 48 48 117 48 48 48 48 117 48 48 48 48 117 48 48 48 48 117 48 48 48 49]

Reading from the source code, the cli first read the argv as string, then directly convert them to []byte. And \u0001 being a null character is impossible to type in the cli AFAK. I am attempting to write a PR to solve this in some way, but being a new user of bbolt, I need some advices on the following ideas:

  1. try to look for and resolve any \uXXXX in the input, but this would cause some bucket that have \u in their name to have problem with cli.
  2. add a optional control flag that only valid for the following 1 [bucket], usage: bolt keys PATH [[-u] [BUCKET]...], that will parse the \u within it or treat it as an sequence number.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant