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

Support wildcard queries #1

Merged
merged 2 commits into from
Jan 16, 2017
Merged

Support wildcard queries #1

merged 2 commits into from
Jan 16, 2017

Conversation

sean-roberts
Copy link
Collaborator

flat-file-db support for micro-analytics/micro-analytics-cli#29

@sean-roberts sean-roberts requested a review from mxstbr January 15, 2017 19:30
@sean-roberts
Copy link
Collaborator Author

@mxstbr can you check this out?

Copy link
Member

@mxstbr mxstbr left a 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)
Copy link
Member

@mxstbr mxstbr Jan 16, 2017

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)

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

Copy link
Member

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!

@mxstbr
Copy link
Member

mxstbr commented Jan 16, 2017

Sorry, I thought I'd left a comment earlier! Must've closed before I submitted it... 😕

@sean-roberts
Copy link
Collaborator Author

Updated 👍

Copy link
Member

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, LGTM

@mxstbr mxstbr merged commit 17b413b into master Jan 16, 2017
@mxstbr mxstbr deleted the wildcard-support branch January 16, 2017 17:08
@sean-roberts
Copy link
Collaborator Author

want to publish a new release to npm?

@mxstbr
Copy link
Member

mxstbr commented Jan 17, 2017

Oh yeah I will!

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.

2 participants