MCPcopy Create free account
hub / github.com/pydio/cells / TestBleveQueryToJSONPathOneField

Function TestBleveQueryToJSONPathOneField

common/storage/boltdb/query_test.go:162–193  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

160}
161
162func TestBleveQueryToJSONPathOneField(t *testing.T) {
163
164 Convey("Test JsonPath - Actual Data", t, func() {
165 var jsonData map[string]interface{}
166 er := json.Unmarshal([]byte(activities), &jsonData)
167 So(er, ShouldBeNil)
168 acJson := jsonData["items"].([]interface{})[0]
169 So(acJson, ShouldNotBeNil)
170 {
171 eval, _, er := BleveQueryToJSONPath("id:\"*activity*\"", "$", false, id, true)
172 So(er, ShouldBeNil)
173 So(eval, ShouldNotBeNil)
174 //So(jpath, ShouldEqual, "length($[?(@.id==\"/activity-13843\")])")
175 s, er := eval(context.Background(), []interface{}{acJson})
176 So(er, ShouldBeNil)
177 So(s, ShouldEqual, 1)
178 }
179
180 {
181 eval, p, er := BleveQueryToJSONPath("updatedTS:>=1715866720", "$", false, id, true)
182 t.Log(p)
183 So(er, ShouldBeNil)
184 So(eval, ShouldNotBeNil)
185 //So(jpath, ShouldEqual, "length($[?(@.id==\"/activity-13843\")])")
186 s, er := eval(context.Background(), []interface{}{acJson})
187 So(er, ShouldBeNil)
188 So(s, ShouldEqual, 1)
189 }
190
191 })
192
193}
194
195var (
196 activities = `

Callers

nothing calls this directly

Calls 3

BleveQueryToJSONPathFunction · 0.85
LogMethod · 0.80
UnmarshalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…