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

Allow Union Queries for Squirrel #320

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

ovadbar
Copy link

@ovadbar ovadbar commented May 31, 2022

Added some tests and a fix for generating union queries.

nyergler added a commit to polytomic/squirrel that referenced this pull request Oct 20, 2022
@joeyjoey1995
Copy link

Is this going to be merged?

@mikolajkucinski
Copy link

Is it going to be merged soon by any chance?

@Tochemey
Copy link

@mikeschinkel please when is this going to merged? This is really critical for us.

@ovadbar
Copy link
Author

ovadbar commented Dec 29, 2022

This is kind of a hack to do it without my merge. You have to include the order and limit separately.

	m, n, _ := selAccount.ToSql()
	selUnion = selBusiness.Suffix(" UNION "+m+" ORDER BY created "+order+" LIMIT "+limit+" OFFSET "+offset, n...)

et added a commit to highlight/highlight that referenced this pull request Mar 2, 2023
## Summary

<!--
Ideally, there is an attached Linear ticket that will describe the
"why".

If relevant, use this section to call out any additional information
you'd like to _highlight_ to the reviewer.
-->

This PR adds support to filter by the log level (internally called
`SeverityText`).

Will follow up for adding support for trace id and other non-custom
attributes.

This PR also replaces
[squirrel](https://github.com/Masterminds/squirrel) with
[go-sqlbuilder](https://github.com/huandu/go-sqlbuilder). There's a
couple reasons for this:

* squirrel is in
[maintenance](https://github.com/Masterminds/squirrel#squirrel-is-complete)
mode where as go-sqlbuilder has active development.
* squirrel lacks `UNION` support. We'll need this for permalinking
([example](https://github.com/highlight/highlight/pull/4417/files#diff-e913069aa4c9c7492c6180d43d70b4d9200d25b074a1b346c87319b510b0327fR72-R95)).
Per the previous point, it doesn't seem like squirrel will add union
support even with a [PR
ready](Masterminds/squirrel#320 (comment)).
* seems like squirrel has some design pitfalls (see
[FAQ](https://github.com/huandu/go-sqlbuilder#whats-the-difference-between-this-package-and-squirrel)).



## How did you test this change?

<!--
Frontend - Leave a screencast or a screenshot to visually describe the
changes.
-->

Unit tests added for testing level filtering. Our existing tests should
cover the squirrel -> go-sqlbuilder transition

Click test:

![Kapture 2023-03-01 at 16 25
41](https://user-images.githubusercontent.com/58678/222289818-aed17785-d41e-4603-92f0-9def5f7ba74f.gif)


## Are there any deployment considerations?

<!--
 Backend - Do we need to consider migrations or backfilling data?
-->

N/A
@yazver
Copy link

yazver commented Mar 21, 2023

🤔

@sergelerner
Copy link

🤔

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.

None yet

8 participants