Closed mrgleeco closed 5 years ago
Totals | |
---|---|
Change from base Build 305: | 0.0% |
Covered Lines: | 951 |
Relevant Lines: | 951 |
Totals | |
---|---|
Change from base Build 305: | 0.0% |
Covered Lines: | 951 |
Relevant Lines: | 951 |
Please change the target branch from master
to dev
How can I run the query ( SELECT * FROM . WHERE age < 30
)?
{
"one":{
"name":"John",
"age":28
},
"two":{
"name":"Jane",
"age":30
},
"three":{
"name":"Tom",
"age":28
}
}
j := gojsonq.New().FromString(data)
ct := j.Where("*.age", "=", 28).Get() // or more nested like. "*.*.age"
fmt.Println(ct)
This functionality seems extra; orthogonal (additional?) to the proposed patch.
Are wildcards supported in Where
? All docs illustrate example arg strings as key op val
, not keymatch
This might be reasonable in future work; docs could illustrate the current behavior and its limits
Issue #24 had an example of querying objects. In this particular case you need something like pattern matching/other good solution. I'm not sure what would be the use case of using Where
for single object
the context is a single message object delivered in a queue (think pubsub or sns). In some cases it may be desirable to filterJSON. Use of the Count()
can help guide further message handling
ping - any interest in merging this?
As Where
clause is unnecessary for a single object query, you can simply use the Find
method go get the value. I'm closing this PR.
Thank you
Change to enable queries on standalone objects. This makes queries like this possible: