MCPcopy Create free account
hub / github.com/RedisGraph/redisgraph-go / TestParameterizedQuery

Function TestParameterizedQuery

client_test.go:309–323  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

307}
308
309func TestParameterizedQuery(t *testing.T) {
310 createGraph()
311 params := []interface{}{1, 2.3, "str", true, false, nil, []interface {}{0, 1, 2}, []interface {}{"0", "1", "2"}}
312 q := "RETURN $param"
313 params_map := make(map[string]interface{})
314 for index, param := range params {
315 params_map["param"] = param
316 res, err := graph.ParameterizedQuery(q, params_map);
317 if err != nil {
318 t.Error(err)
319 }
320 res.Next()
321 assert.Equal(t, res.Record().GetByIndex(0), params[index], "Unexpected parameter value")
322 }
323}
324
325func TestCreateIndex(t *testing.T) {
326 res, err := graph.Query("CREATE INDEX ON :user(name)")

Callers

nothing calls this directly

Calls 5

createGraphFunction · 0.85
ParameterizedQueryMethod · 0.80
NextMethod · 0.80
GetByIndexMethod · 0.80
RecordMethod · 0.80

Tested by

no test coverage detected