Comments (3)
Would you explain the use case? It evaluates some jq code constructed from the input JSON?
from gojq.
This is unlikely to be included until jq implements this.
from gojq.
Maybe useful for someone else:
func eval(c interface{}, a []interface{}) gojq.Iter {
src, ok := a[0].(string)
if !ok {
return gojq.NewIter(fmt.Errorf("%v: src is not a string", a[0]))
}
gq, err := gojq.Parse(src)
if err != nil {
return gojq.NewIter(err)
}
gc, err := gojq.Compile(
gq,
p.CompilerOptions()...,
)
if err != nil {
return gojq.NewIter(err)
}
return gc.Run(c)
}
gojq.WithIterFunction("eval", 1, 1, eval)
from gojq.
Related Issues (20)
- add `pick` to builtin.jq HOT 2
- jq: query failed: %!v(PANIC=Error method: invalid type: []map[string]interface {} HOT 6
- When using `--args` with `-f` the first argument is treated as input file unless you use `--` HOT 1
- FR: Support jq's tcl-style multiline comments HOT 9
- Compile funcMatch Regex only in runtime
- gojq: compile error: variable not defined: $ARGS (while reading ~/.jq) HOT 1
- Can gojq be used in a streaming way? HOT 2
- Unexpected results occur when passing based on pointer HOT 1
- Change in behavior between go1.20 and go 1.21 (unable to query document) HOT 3
- Compiled JQ in not execution safe for constant mutable structs HOT 8
- Ability to concurrently run many queries on a single JSON object
- Duplicate keys in object literals have inconsistent behavior HOT 4
- Curious bug when reading from /dev/urandom or /dev/random HOT 2
- Allocated maps are ignored
- Support strings with JSON as input HOT 3
- `halt/0` (& co.) have the old jq 1.6 behaviour HOT 1
- Example of retrieving JSON or unmarshalled object HOT 4
- error parsing regexp: invalid named capture HOT 2
- Tests fail for s390x in Fedora since 0.12.15 HOT 3
- Question about handling NDJSON with the library HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gojq.