-
Notifications
You must be signed in to change notification settings - Fork 2
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
Support wildcard queries #1
Conversation
54e1df6
to
603f158
Compare
@mxstbr can you check this out? |
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.
LGTM, one tiny question though
@@ -27,7 +33,9 @@ module.exports = { | |||
// Get all values starting with a certain pathname and filter their views | |||
getAll: async function getAll(options) { | |||
const data = {} | |||
const keys = (await module.exports.keys()).filter(key => key.startsWith(options.pathname)) | |||
const keys = (await module.exports.keys()).filter((key) => { | |||
return options.wildcard ? key.match(keyRegex(options.pathname)) : key.startsWith(options.pathname) |
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 won't work I'm pretty sure, since options.wildcard
comes from the query param it'll be "false"
, a string, not false
, a boolean. (also this should be opt-out I thought, not opt-in)
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.
You wouldn't have known this because I haven't don't the analytics side, but I did not plan on sending the query param down. I planned on sending the bool value down to it based on the query param. As a practice, we should always send down actual bool values instead of having any type of adapter have to worry about that nuance
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.
but you're right on the opt-out part. That was a last minute swap
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.
also going to change it to ignoreWildcard
as that makes more sense
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.
👌 you're right, good call on sending down the booleans!
Sorry, I thought I'd left a comment earlier! Must've closed before I submitted it... 😕 |
Updated 👍 |
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.
Awesome, LGTM
want to publish a new release to npm? |
Oh yeah I will! |
flat-file-db support for micro-analytics/micro-analytics-cli#29