// BreakQueryIntoTokens determines which filters are being used by the query string
// and what parameters were provided to the filters.
430961
func (c *Client) BreakQueryIntoTokens(ctx context.Context, query string) (*HostQueryTokens, error) {
	var tokens HostQueryTokens

	options := struct {
		Query string `url:"query"`
	}{Query: query}
	req, err := c.NewRequest("GET", hostSearchTokensPath, options, nil)
	if err != nil {
		return nil, err
	}

	if err := c.Do(ctx, req, &tokens); err != nil {
		return nil, err
	}

	return &tokens, nil
}
25968
func (b *FilterQueryBuilder) AddQueryStringFilter(querystring string, analyseWildcard bool) *FilterQueryBuilder {
	if len(strings.TrimSpace(querystring)) == 0 {
		return b
	}

	b.filters = append(b.filters, &QueryStringFilter{
		Query:           querystring,
		AnalyzeWildcard: analyseWildcard,
	})
	return b
}
969225
func NewDisjunctionQuery(queries ...FtsQuery) *DisjunctionQuery {
	q := &DisjunctionQuery{newFtsQueryBase()}
	q.options["disjuncts"] = []FtsQuery{}
	return q.Or(queries...)
}
171864
func (q *QueryParam) encodeFilters() ([][]byte, error) {
	var filters [][]byte

	// Add the node filter
	if len(q.FilterNodes) > 0 {
		if buf, err := encodeFilter(filterNodeType, q.FilterNodes); err != nil {
			return nil, err
		} else {
			filters = append(filters, buf)
		}
	}

	// Add the tag filters
	for tag, expr := range q.FilterTags {
		filt := filterTag{tag, expr}
		if buf, err := encodeFilter(filterTagType, &filt); err != nil {
			return nil, err
		} else {
			filters = append(filters, buf)
		}
	}

	return filters, nil
}
137731
func (a *StepIntoArgs) SetBreakOnAsyncCall(breakOnAsyncCall bool) *StepIntoArgs {
	a.BreakOnAsyncCall = &breakOnAsyncCall
	return a
}
278843
func (f *aclFilter) filterCheckServiceNodes(nodes *structs.CheckServiceNodes) {
	csn := *nodes
	for i := 0; i < len(csn); i++ {
		node := csn[i]
		if f.allowNode(node.Node.Node) && f.allowService(node.Service.Service) {
			continue
		}
		f.logger.Printf("[DEBUG] consul: dropping node %q from result due to ACLs", node.Node.Node)
		csn = append(csn[:i], csn[i+1:]...)
		i--
	}
	*nodes = csn
}
734827
func (idx *CfIndex) FilterHashesByBlockHashes(blockHashes []*chainhash.Hash,
	filterType wire.FilterType) ([][]byte, error) {
	return idx.entriesByBlockHashes(cfHashKeys, filterType, blockHashes)
}
877754
func (idx *CfIndex) FiltersByBlockHashes(blockHashes []*chainhash.Hash,
	filterType wire.FilterType) ([][]byte, error) {
	return idx.entriesByBlockHashes(cfIndexKeys, filterType, blockHashes)
}
89660
func (opts *BlockBasedTableOptions) SetWholeKeyFiltering(value bool) {
	C.rocksdb_block_based_options_set_whole_key_filtering(opts.c, boolToChar(value))
}
497375
func (fm *filterManager) RemoveFilterByIndex(index int) {
	fm.fmLocker.Lock()
	n := len(fm.filters)
	if index < 0 && index >= n {
		fm.fmLocker.Unlock()
		return
	}
	if index == n-1 {
		fm.filters = fm.filters[:index]
	} else {
		fm.filters = append(fm.filters[:index], fm.filters[index+1:]...)
	}
	fm.fmLocker.Unlock()
}
1163089
func (client *Client) GetIsolationSegments(query ...Query) ([]IsolationSegment, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetIsolationSegmentsRequest,
		Query:       query,
	})
	if err != nil {
		return nil, nil, err
	}

	var fullIsolationSegmentsList []IsolationSegment
	warnings, err := client.paginate(request, IsolationSegment{}, func(item interface{}) error {
		if isolationSegment, ok := item.(IsolationSegment); ok {
			fullIsolationSegmentsList = append(fullIsolationSegmentsList, isolationSegment)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   IsolationSegment{},
				Unexpected: item,
			}
		}
		return nil
	})

	return fullIsolationSegmentsList, warnings, err
}
389148
func keyFromQuery(param string) keyExtractor {
	return func(c echo.Context) (string, error) {
		key := c.QueryParam(param)
		if key == "" {
			return "", errors.New("missing key in the query string")
		}
		return key, nil
	}
}
141875
func (conn *FakeVTGateConn) SplitQuery(
	ctx context.Context,
	keyspace string,
	query string,
	bindVars map[string]*querypb.BindVariable,
	splitColumns []string,
	splitCount int64,
	numRowsPerQueryPart int64,
	algorithm querypb.SplitQueryRequest_Algorithm) ([]*vtgatepb.SplitQueryResponse_Part, error) {

	response, ok := conn.splitQueryMap[getSplitQueryKey(
		keyspace, query, splitColumns, splitCount, numRowsPerQueryPart, algorithm)]
	if !ok {
		return nil, fmt.Errorf(
			"no match for keyspace: %s,"+
				" query: %v,"+
				" splitColumns: %v,"+
				" splitCount: %v"+
				" numRowsPerQueryPart: %v"+
				" algorithm: %v",
			keyspace, query, splitColumns, splitCount, numRowsPerQueryPart, algorithm)
	}
	reply := make([]*vtgatepb.SplitQueryResponse_Part, len(response.reply))
	copy(reply, response.reply)
	return reply, nil
}
612818
func (m *Sqlbridge) parseSqlInsert() (*SqlInsert, error) {

	// insert into mytable (id, str) values (0, "a")
	req := NewSqlInsert()
	req.kw = m.Cur().T
	m.Next() // Consume Insert or Replace

	// INTO
	if m.Cur().T != lex.TokenInto {
		return nil, fmt.Errorf("expected INTO but got: %v", m.Cur())
	}
	m.Next() // Consume INTO

	// table name
	switch m.Cur().T {
	case lex.TokenTable:
		req.Table = m.Cur().V
		m.Next()
	default:
		return nil, fmt.Errorf("expected table name but got : %v", m.Cur().V)
	}

	// list of fields
	cols, err := m.parseFieldList()
	if err != nil {
		return nil, err
	}
	req.Columns = cols

	m.Next() // left paren starts lisf of values
	switch m.Cur().T {
	case lex.TokenValues:
		m.Next() // Consume Values keyword
	case lex.TokenSelect:
		sel, err := m.parseSqlSelect()
		if err != nil {
			return nil, err
		}
		if len(sel.From) == 0 {
			return nil, m.ErrMsg("Expected FROM <sources>")
		}
		req.Select = sel
		return req, nil
	default:
		return nil, m.ErrMsg("expected INSERT (columns) VALUES <values>")
	}

	colVals, err := m.parseValueList()
	if err != nil {
		return nil, err
	}
	req.Rows = colVals
	return req, nil
}
1164344
func (s *lockBasedTxSimulator) ExecuteQueryWithMetadata(namespace, query string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error) {
	if err := s.checkBeforePaginatedQueries(); err != nil {
		return nil, err
	}
	return s.lockBasedQueryExecutor.ExecuteQueryWithMetadata(namespace, query, metadata)
}
148045
func getQueries(raw []string) []string {
	var res []string

	for _, q := range raw {
		for _, qs := range strings.Split(q, ";") {
			if nq := strings.TrimSpace(qs); len(nq) > 0 {
				res = append(res, nq+";")
			}
		}
	}

	return res
}
864024
func (s *QueryInput) SetQueryFilter(v map[string]*Condition) *QueryInput {
	s.QueryFilter = v
	return s
}