MCPcopy
hub / github.com/dgraph-io/dgraph / processQuery

Function processQuery

query/common_test.go:47–66  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, query string)

Source from the content-addressed store, hash-verified

45}
46
47func processQuery(ctx context.Context, t *testing.T, query string) (string, error) {
48 txn := client.NewTxn()
49 defer func() {
50 if err := txn.Discard(ctx); err != nil {
51 t.Logf("error discarding txn: %v", err)
52 }
53 }()
54
55 res, err := txn.Query(ctx, query)
56 if err != nil {
57 return "", err
58 }
59
60 response := map[string]interface{}{}
61 response["data"] = json.RawMessage(string(res.Json))
62
63 jsonResponse, err := json.Marshal(response)
64 require.NoError(t, err)
65 return string(jsonResponse), err
66}
67
68func processQueryRDF(ctx context.Context, query string) (string, error) {
69 txn := client.NewTxn()

Calls 1

QueryMethod · 0.45

Tested by

no test coverage detected