-
Notifications
You must be signed in to change notification settings - Fork 184
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
Comparison operators on indexed+checked attrs #531
Conversation
View Vercel preview at instant-www-js-checked-idxes-jsv.vercel.app. |
function matcherForPatternPart(patternPart) { | ||
switch (typeof patternPart) { | ||
case "string": | ||
return patternPart.startsWith("?") ? matchVariable : matchExact; | ||
case "object": |
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.
We already do all the filtering in the store, so this saves us an extra comparison on the data.
@@ -57,7 +58,7 @@ | |||
(when (seq aggregates) | |||
{:aggregate aggregates})))) | |||
|
|||
(defn- is-pretty-eq? | |||
(defmacro is-pretty-eq? |
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.
Making this a macro helps jump-to-definition jump to the place is-pretty-eq?
is used instead of jumping here.
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.
...This is beautiful!
Adds
$gt
,$lt
,$gte
, and$lte
comparison operators for indexed attrs with checked types.If
person.birthdate
is an indexed attr typed as adate
, you can do something like:How it works
We add new partial indexes on the
triples
table that extracts the typed data from the json. This is the number index for example:Our comparison query uses the index we created:
For strings, we use a gist index with the
pg_trgm
extension. It allows us to use the index forlike
queries and potentially opens up the possibility for doing fuzzy search later.Other changes
TODOS before deploy:
create index concurrently
so that we don't lock up the db when running the migration