This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 267
Add regex-based "glob" pattern matching to hdk::query #781
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
o Change the Holochain query API to accept a Vec<String> vs. String o If multiple EntryType names (or one with "glob" wildcards) is used, then produce a GlobSetBuilder matcher to recognize the selected names.
o hdk::query( "post".into() or vec!["post","whatever"].into() work
zippy
approved these changes
Dec 20, 2018
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.
Looks good. There are a couple TODOs that need to be converted to followup tickets and the ticket number added into the code so at least there's and internal and external reference to the followup.
OK, TODOs ticketed. Should be good to do! |
Connoropolous
approved these changes
Dec 22, 2018
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 know this will keep evolving, but this is a nice improvement!
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: Re-submitted pull request using local branch in holochain repo.
o Change the Holochain query API to accept a
Vec<String>
vs.String
o If multiple EntryType names (or one with "glob" wildcards) is used,
then produce a GlobSetBuilder matcher to recognize the selected names.
There is no way to get more than a single EntryType via hdk::query.
The primary purpose of this change is to support querying multiple EntryType names in a single hdk::query request. To do this efficiently, a single regex encompassing all of the desired EntryType names is produced.
The globset::GlobSetBuilder is used to do this, and also supports the full "glob" pattern matching on EntryType names. This includes the concept of path-like namespaces for EntryType names. For example, if you have 3 EntryTypes
"one"
,"two"
and"three"
related to the concept "tx" in your Holochain application, you can name them"tx/one"
,"tx/two"
and"tx/three"
. Then, when you want to query all of your tx-related entries from your local chain, you'd callLater, when you add a fourth "tx/four" EntryType, the above code would automatically get all the tx-related EntryTypes.
You can also do things like get all EntryTypes except the System EntryTypes:
"[!%]*"
.NOTE: Changes the hdk::query API!