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

Print included query info fields as yaml #526

Merged
merged 11 commits into from
Dec 16, 2024
Merged

Print included query info fields as yaml #526

merged 11 commits into from
Dec 16, 2024

Conversation

ptpaterson
Copy link
Contributor

@ptpaterson ptpaterson commented Dec 13, 2024

Ticket(s): FE-6247

Problem

As a user, we want to be able to view various query info fields when running queries.

Solution

This PR add a new common query option called include, which can be an array of one or more of the following:

["all", "txnTs", "schemaVersion", "summary", "queryTags", "stats"]

If "all" is specified, all possible info fields should be displayed.

If --performanceHints is used, then at least the summary should be displayed. Don't worry if there are other components to the summary.

The query info fields should displayed so that they can be read by people. Most importantly, the summary field should be displayed plainly, formatted the way it comes back from the db. That is, don't show a weird string full of escape characters.

I used the yaml package to format the query info as an object and loaded the yaml colorizer. If color is on, we also apply FQL colorizing to appropriate summary lines.

Result

query
image

shell
image

shell with toggling
image

image

Testing

All existing tests pass.

WIP: will add some more tests

src/lib/command-helpers.mjs Outdated Show resolved Hide resolved
src/lib/command-helpers.mjs Outdated Show resolved Hide resolved
src/lib/command-helpers.mjs Show resolved Hide resolved
src/lib/command-helpers.mjs Outdated Show resolved Hide resolved
src/lib/command-helpers.mjs Outdated Show resolved Hide resolved
src/lib/fauna-client.mjs Show resolved Hide resolved
@ptpaterson ptpaterson marked this pull request as ready for review December 16, 2024 18:30
@ptpaterson ptpaterson requested a review from a team as a code owner December 16, 2024 18:30
@ptpaterson ptpaterson merged commit b381a73 into v3 Dec 16, 2024
4 checks passed
@ptpaterson ptpaterson deleted the fe-6247-query-info branch December 16, 2024 19:37
@mwilde345 mwilde345 mentioned this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants