-
Notifications
You must be signed in to change notification settings - Fork 226
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
Add Negentropy format #1012
Add Negentropy format #1012
Conversation
Also since my code is printing datetimes as field descriptions, the tests were succeeding here but failing on the CI because of the timezone. I've changed the testdata now to expect GMT, but I don't know of a way to make this seamless for everybody. Should I add this? diff --git a/Makefile b/Makefile
index 81ca73f3..79a4dd00 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ test-race: always testgo-race testjq testcli
# figure out all go packages with test files
testgo: PKGS=$(shell find . -name "*_test.go" | xargs -n 1 dirname | sort | uniq)
testgo: always
- go test -timeout 20m ${RACE} ${VERBOSE} ${COVER} ${PKGS}
+ TZ=GMT go test -timeout 20m ${RACE} ${VERBOSE} ${COVER} ${PKGS}
testgo-race: RACE=-race
testgo-race: testgo Or should I stop printing datetimes? |
Sounds like exactly like my use case for fq and glad to hear it was useful!
Had a quick look and it looks good, i will have closer look soon
Huh was sure it was lastest was part of the midi PR, can be part of this PR, no worries
Yes there is. fq has full jq interpreter with some extra functions and also each decoder is available as a function. So you can do things like this: $ xxd -ps ints.msgpack | fq -o line_bytes=16 -Rs 'split("\n") | add | from_hex | msgpack'
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│.{}: (msgpack)
0x00│dc │. │ type: "array16" (0xdc)
0x00│ 00 1a │ .. │ length: 26
0x00│ 00 01 02 03 04 05 06 07 08 09 7f cc 80│ .............│ elements[0:26]:
0x10│ff fe fd fc fb fa f9 f8 e1 e0 ce ff ff ff ff d3│................│
* │until 0x31.7 (end) (47) │ │ See https://github.com/wader/fq/blob/master/doc/usage.md#encodings-serializations-and-hashes for more details and decoding/encoding functions. |
Hmm it would be great if the default output was not dependent on environment and will probably be a mess for other package maintainers if not. There has been similar issue with other formats and then i think the solution was to output timestamp description in UTC, would that work? and if you really want local time etc you could add a format option to set it, or alternatively give some examples how to use the jq date/time functions to produce a local timestamp |
Oh, cool! So this is what I wanted for my tests (somewhat simpler):
I had skimmed that usage document and seen the |
I've changed it to display the timestamp description to be always UTC. In the meantime I learned about the difference between symbolic and actual values and fixed one other thing. I think it's much better now. Later I'll explore the decoder-specific options more (another thing I didn't know), but I think it's not necessary for now. |
👍 ah yes no need for
No worries! yeah those things are not easily discoverable atm :( maybe should work on some guide or tutorial how to work with fq |
Yeap! added a comment about different ways but i think the current way works fine unless you want to change it.
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good to me! let me know if your ready
…comments on source of test samples.
I'm ready. |
Thanks! |
🥳 what are you building using RBSR? have to read up a bit about it, seems useful! |
https://github.com/hoytech/negentropy is a simple protocol for generic syncing of datasets between a client and a server.
While writing an implementation of it the binary format of the messages was confusing me (even though it is pretty simple) so I figured it would help others to be able to visualize it (it ended up helping me too even though I thought I already knew everything when I started writing this).
Hopefully I did everything right this time.
make doc
ended up modifying some unrelated stuff.One question: is there a way for
fq
to read input as hex from the stdin? I was testing using hex messages and kept having to usexxd
to convert because I couldn't find a way to tellfq
to read as hex.