// Creates a new common query.
966158
func NewCommonQuery(name string, query string) CommonQuery {
	q := CommonQuery{name: name, query: query}
	return q
}
1249331
func NewQueryObjectsArgs(prototypeObjectID RemoteObjectID) *QueryObjectsArgs {
	args := new(QueryObjectsArgs)
	args.PrototypeObjectID = prototypeObjectID
	return args
}
994851
func NewPhraseQuery(terms ...string) *PhraseQuery {
	q := &PhraseQuery{newFtsQueryBase()}
	q.options["terms"] = terms
	return q
}
172227
func New() Definition {
	var q Definition
	q.Where = make(map[string]interface{})
	q.Sort = make(map[string]interface{})
	return q
}
1100505
func (dht *IpfsDHT) newQuery(k string, f queryFunc) *dhtQuery {
	return &dhtQuery{
		key:         k,
		dht:         dht,
		qfunc:       f,
		concurrency: maxQueryConcurrency,
	}
}
678214
func NewQuerySM() Body {
	b := newQuerySM(&Header{ID: QuerySMID})
	b.init()
	return b
}
872606
func (s *HTTPServer) PreparedQueryGeneral(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
	switch req.Method {
	case "POST":
		return s.preparedQueryCreate(resp, req)

	case "GET":
		return s.preparedQueryList(resp, req)

	default:
		return nil, MethodNotAllowedError{req.Method, []string{"GET", "POST"}}
	}
}
1081038
func (me *DefaultAdapter) CommonTableExpressionSql(buf *SqlBuilder, cte CommonTableExpression) error {
	if err := me.Literal(buf, cte.Name()); err != nil {
		return err
	}
	buf.Write(me.AsFragment)
	if err := me.Literal(buf, cte.SubQuery()); err != nil {
		return err
	}
	return nil
}
788824
func NewIdsQuery(types ...string) *IdsQuery {
	return &IdsQuery{
		types:  types,
		values: make([]string, 0),
	}
}
802130
func (c *PreparedQuery) Create(query *PreparedQueryDefinition, q *WriteOptions) (string, *WriteMeta, error) {
	r := c.c.newRequest("POST", "/v1/query")
	r.setWriteOptions(q)
	r.obj = query
	rtt, resp, err := requireOK(c.c.doRequest(r))
	if err != nil {
		return "", nil, err
	}
	defer resp.Body.Close()

	wm := &WriteMeta{}
	wm.RequestTime = rtt

	var out struct{ ID string }
	if err := decodeBody(resp, &out); err != nil {
		return "", nil, err
	}
	return out.ID, wm, nil
}
1202711
func NewMatchQuery(match string) *MatchQuery {
	q := &MatchQuery{newFtsQueryBase()}
	q.options["match"] = match
	return q
}
197375
func NewQuery(query ast.Body) *Query {
	return &Query{
		query:        query,
		genvarprefix: ast.WildcardPrefix,
	}
}
1099873
func NewMoreLikeThisFieldQuery(name, likeText string) MoreLikeThisFieldQuery {
	q := MoreLikeThisFieldQuery{
		name:      name,
		likeText:  likeText,
		stopWords: make([]string, 0),
	}
	return q
}
641186
func (b *BaseBuilder) NewQuery(sql string) *Query {
	return NewQuery(b.db, b.executor, sql)
}
406544
func (_m *QueryCreator) NewQueryExecutor() (ledger.QueryExecutor, error) {
	ret := _m.Called()

	var r0 ledger.QueryExecutor
	if rf, ok := ret.Get(0).(func() ledger.QueryExecutor); ok {
		r0 = rf()
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(ledger.QueryExecutor)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func() error); ok {
		r1 = rf()
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1183430
func NewMatchQuery(name string, text interface{}) *MatchQuery {
	return &MatchQuery{name: name, text: text}
}
69639
func NewQuery(db *DB, executor Executor, sql string) *Query {
	rawSQL, placeholders := db.processSQL(sql)
	return &Query{
		executor:     executor,
		sql:          sql,
		rawSQL:       rawSQL,
		placeholders: placeholders,
		params:       Params{},
		FieldMapper:  db.FieldMapper,
		LogFunc:      db.LogFunc,
		PerfFunc:     db.PerfFunc,
	}
}