MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / queryResultString

Function queryResultString

db/functions/n1ql_function_test.go:72–87  ·  view source on GitHub ↗
(t *testing.T, iter sgbucket.QueryResultIterator)

Source from the content-addressed store, hash-verified

70}
71
72func queryResultString(t *testing.T, iter sgbucket.QueryResultIterator) string {
73 if iter == nil {
74 return ""
75 }
76 result := []any{}
77 var row any
78 for iter.Next(base.TestCtx(t), &row) {
79 result = append(result, row)
80 }
81 assert.NoError(t, iter.Close())
82 j, err := json.Marshal(result)
83 if !assert.NoError(t, err) {
84 return ""
85 }
86 return string(j)
87}
88
89func assertQueryResults(t *testing.T, expected string, iter sgbucket.QueryResultIterator) {
90 if actual := queryResultString(t, iter); actual != "" {

Callers 2

assertQueryResultsFunction · 0.85
testUserQueriesAsUserFunction · 0.85

Calls 3

TestCtxFunction · 0.92
CloseMethod · 0.65
NextMethod · 0.45

Tested by

no test coverage detected