-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
fq and changes in fq:s gojq fork #153
Comments
First of all, congratulation for releasing fq after hard work for months. The tool looks pretty useful. I have been working on a binary editor called bed and also contributed a bit to kaitai struct, but I didn't come up with this idea. I searched for gojq issues you opened, looked into the commits of your fork, and see how it was hard to make gojq work to achieve your goal. |
Thanks! Yes was lot of work but mostly very interesting and i've learned a lot. I thought it would be a couple of months to make something that felt useable by others, took one year :) Yes think i saw bed once when i looked thru your other projects so i assumed you might find fq useful. I have some vague plans to support interpreting basic kaitai definitions and maybe something else on top of the decode API for fq, will see how it goes. Also been experimenting with decoder DSL:s in jq, tricky but possible i think.
Yes fully understand that. The JQValue addition was by far the hardest to get working and i've probably rewritten it in different way 3-4 times to make it do all things i wanted. For example i really wanted gojq to handle the values as "shallow" as possible to preserve the original types, that way you can usually use all standard functions etc and get a JQValue out the other end. Your probably right that the current JQValue interface is quite biased towards fq:s usage. It would be interesting to try some other usages to make it more generic. Would you be interested to include some of the refactorings like
I haven't thought about it from library authors prespective, thanks for the link, i will surely read it to try understand the issue. Construction i haven't thought about either, you mean somehow allow JQValue to be used in literals or define new literals? (interesting idea :) Yes i agree, implementing a JQValue or something similar is no easy task i've noticed, you have to be quite careful to re-implement a lot of details to make things feel normal to a user. How do you feel about the query AST additions? I first tried to do a REPL with completion mostly in go, but it got very messy so i ended up calling out to helper functions in jq and at some point it just felt better to switch it around. And so far im very happy with the result, the slurp support was interesting to do, but i doubt many will use it, but felt hacky without it (
Thanks, and i'm very grateful! without it and your helpfulness I don't think fq would have existed today. And please let me know if you have any other questions about fq. BTW, if you didn't notice fq do support JSON as input also if you want to use the REPL to play around with completion and iterate on some query. |
If you mean JSON tags, I can't include this neither. I don't ensure the compatibility of the query syntax tree and JSON marshalization can break between versions. Actually the query of |
Yes agree using JSON tags on structs in gojq for this is not a good idea, as mentioned in #123, this was more or quick way to to get access to the AST to see if it was a possible way of doing a nice REPL in jq. Happy new year btw! |
BTW have i given you credit correctly for the gojq parts i forked for fq? (some code in https://github.com/wader/fq/tree/master/internal/gojqextra and https://github.com/wader/fq/blob/master/internal/colorjson/encoder.go is based on cli/encoder.go) |
Hello! not really and issue but i hope it's ok to use an issue to discuss and maybe break things out into other PR or issues if needed.
I've finally i've published my gojq based project some days ago that i've been working on for the last year. It's called fq and is result of me wanting a tool to make it easier to inspect, debug, query and work with various binary format. I've experimented with other query languages and implementation languages than go even before that but i know that i really wanted jq as it really felt like a good fit for working with all kind of tree structured data. So when i found gojq i got very excited and with lots of trying and work i think i have something close to what i imagined and it has already help me solve all kind of tasks.
So what i wanted to discuss is various changes to gojq that i've made to make fq possible. I don't have any expectations to get any of them merged but i hope at least some of them might be interesting to merge or partially merge.
The changes can be found in the "fq" branch of my gojq fork https://github.com/wader/gojq/commits/fq
Here are the changes:
toObject
,toString
, ... . It also makesPathValue
public to be used byJQValueEach
.replace
in go.mod so this seemed simpler.And of course i'm more than happy to talk more about fq and help understand how it can be used or how to write decoders etc. It's lacking a lot in documentation at the moment.
And lastly once again i would like to thank you for working on gojq. It has been a pleasure to work with and i really appreciate the engineering put into it. It has been very stable and also fun and educational experience.
Have a great holiday and hope for more nice jq things next year!
The text was updated successfully, but these errors were encountered: