// ExpectRequestRE adds an expected result to the mock.
// queryRE is a regular expression.
// This function should not be called conncurrently with other commands.
551813
func (dc *MockDBClient) ExpectRequestRE(queryRE string, result *sqltypes.Result, err error) {
	select {
	case <-dc.done:
		dc.done = make(chan struct{})
	default:
	}
	dc.expect = append(dc.expect, &mockExpect{
		query:  queryRE,
		re:     regexp.MustCompile(queryRE),
		result: result,
		err:    err,
	})
}
355310
func Expect(t Errorf, have, want interface{}, iter ...int) {
	if !reflect.DeepEqual(have, want) {
		file, line := caller()
		t.Errorf(equal, file, line, exampleNum(iter), have, have, want, want)
	}
}
379739
func (e *Expect) GET(path string, pathargs ...interface{}) *Request {
	return e.Request("GET", path, pathargs...)
}
256479
func (m *MockAccessResponder) GetExtra(arg0 string) interface{} {
	ret := m.ctrl.Call(m, "GetExtra", arg0)
	ret0, _ := ret[0].(interface{})
	return ret0
}
983516
func (s *Service) Query(ctx context.Context, req *query.Request) (flux.ResultIterator, error) {
	resp, err := s.query(ctx, req)
	if err != nil {
		return nil, err
	}

	// Decode the response into the JSON structure.
	var results Response
	if err := json.NewDecoder(resp.Body).Decode(&results); err != nil {
		return nil, err
	}

	// Return a result iterator using the response.
	return NewResponseIterator(&results), nil
}
248600
func (e *Expect) Request(method, path string, pathargs ...interface{}) *Request {
	req := NewRequest(e.config, method, path, pathargs...)

	for _, builder := range e.builders {
		builder(req)
	}

	for _, matcher := range e.matchers {
		req.WithMatcher(matcher)
	}

	return req
}
1172161
func (s *QueryService) Query(ctx context.Context, req *query.Request) (flux.ResultIterator, error) {
	return s.QueryF(ctx, req)
}
446540
func ExpectEq(expected, actual interface{}, errorParts ...interface{}) {
	expectThat(actual, oglematchers.Equals(expected), 1, errorParts)
}
1148486
func (api *API) ServeV1Query(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
	ctx, cancel := api.contextForRequest(r)
	defer cancel()
	l := query.GetLanguage(params.ByName("query_lang"))
	if l == nil {
		jsonResponse(w, http.StatusBadRequest, "Unknown query language.")
		return
	}
	errFunc := defaultErrorFunc
	if l.HTTPError != nil {
		errFunc = l.HTTPError
	}
	select {
	case <-ctx.Done():
		errFunc(w, ctx.Err())
		return
	default:
	}
	h, err := api.GetHandleForRequest(r)
	if err != nil {
		errFunc(w, err)
		return
	}
	if l.HTTPQuery != nil {
		defer r.Body.Close()
		l.HTTPQuery(ctx, h.QuadStore, w, r.Body)
		return
	}
	if l.HTTP == nil {
		errFunc(w, errors.New("HTTP interface is not supported for this query language."))
		return
	}

	par, _ := url.ParseQuery(r.URL.RawQuery)
	limit, _ := strconv.Atoi(par.Get("limit"))
	if limit == 0 {
		limit = 100
	}

	ses := l.HTTP(h.QuadStore)
	bodyBytes, err := ioutil.ReadAll(r.Body)
	if err != nil {
		errFunc(w, err)
		return
	}
	code := string(bodyBytes)

	c := make(chan query.Result, 5)
	go ses.Execute(ctx, code, c, limit)

	for res := range c {
		if err := res.Err(); err != nil {
			if err == nil {
				continue // wait for results channel to close
			}
			errFunc(w, err)
			return
		}
		ses.Collate(res)
	}
	output, err := ses.Results()
	if err != nil {
		errFunc(w, err)
		return
	}
	_ = WriteResult(w, output)
}
614933
func ExpectNe(expected, actual interface{}, errorParts ...interface{}) {
	expectThat(
		actual,
		oglematchers.Not(oglematchers.Equals(expected)),
		1,
		errorParts)
}
988515
func ExpectLe(x, y interface{}, errorParts ...interface{}) {
	expectThat(x, oglematchers.LessOrEqual(y), 1, errorParts)
}
1275850
func ExpectationFailed(w http.ResponseWriter, response interface{}) {
	Respond(w, http.StatusExpectationFailed, response)
}
1111338
func (stub *ChaincodeStub) GetQueryResult(query string) (StateQueryIteratorInterface, error) {
	// Access public data by setting the collection to empty string
	collection := ""
	// ignore QueryResponseMetadata as it is not applicable for a rich query without pagination
	iterator, _, err := stub.handleGetQueryResult(collection, query, nil)

	return iterator, err
}
291771
func SearchResponse(ctx context.Context, requester Requester, r SearchRequest) (*http.Response, error) {
	req, err := PrepSearchRequest(r)
	if err != nil {
		return nil, err
	}
	return requester(ctx, req)
}
245647
func (f QueryHandlerFunc) ServeQuery(ctx context.Context, res QueryResponse, req *QueryRequest) error {
	return f(ctx, res, req)
}
4042
func (t *T) ExpectErrorf(err error, spec string, args ...interface{}) {
	if err != nil {
		return
	}
	prefix := fmt.Sprintf(spec, args...) + ": "
	t.Fatalf("%sError not returned when one was expected.", prefix)
}
1297893
func ExpectEncodings(req *transport.Request, want ...transport.Encoding) error {
	got := req.Encoding
	for _, w := range want {
		if w == got {
			return nil
		}
	}

	return newServerEncodingError(req, want, false /*isResponse*/, false /*isHeader*/, newEncodingMismatchError(want, got))
}