// resolve required Param/QueryParam for access via CII flags.
// Required Params are not generated as pointers
// Special types like Number/UUID need to be converted from String
// %s maps to specialTypeResult.Temps
196691
func flagRequiredTypeVal(a *design.AttributeDefinition, field string) string {
	switch a.Type {
	case design.Number, design.Boolean, design.UUID, design.DateTime, design.Any:
		return "*%s"
	default:
		return field
	}
}
234335
func (d *database) Query(ctx context.Context, query string, bindVars map[string]interface{}) (Cursor, error) {
	req, err := d.conn.NewRequest("POST", path.Join(d.relPath(), "_api/cursor"))
	if err != nil {
		return nil, WithStack(err)
	}
	input := queryRequest{
		Query:    query,
		BindVars: bindVars,
	}
	input.applyContextSettings(ctx)
	if _, err := req.SetBody(input); err != nil {
		return nil, WithStack(err)
	}
	cs := applyContextSettings(ctx, req)
	resp, err := d.conn.Do(ctx, req)
	if err != nil {
		return nil, WithStack(err)
	}
	if err := resp.CheckStatus(201); err != nil {
		return nil, WithStack(err)
	}
	var data cursorData
	if err := resp.ParseBody("", &data); err != nil {
		return nil, WithStack(err)
	}
	col, err := newCursor(data, resp.Endpoint(), d, cs.AllowDirtyReads)
	if err != nil {
		return nil, WithStack(err)
	}
	return col, nil
}
224592
func (csr SummaryPerformanceRequest) GetParams() (params map[string]string) {
	params = make(map[string]string)

	if csr.Resolution != "" {
		params["resolution"] = csr.Resolution
	}

	if csr.IncludeUptime {
		params["includeuptime"] = "true"
	}

	return
}
1027308
func (c *IO) ResolveBlobWithParams(v *IOResolveBlobParams) (string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "IO.resolveBlob", Params: v})
	if err != nil {
		return "", err
	}

	var chromeData struct {
		Result struct {
			Uuid string
		}
	}

	if resp == nil {
		return "", &gcdmessage.ChromeEmptyResponseErr{}
	}

	// test if error first
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", &gcdmessage.ChromeRequestErr{Resp: cerr}
	}

	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", err
	}

	return chromeData.Result.Uuid, nil
}
1018299
func (qr *ChangeDetailsParams) queryString() url.Values {
	qs := make(url.Values, len(qr.Options))
	for _, o := range qr.Options {
		qs.Add("o", o)
	}
	return qs
}
294848
func Query(params map[string]string, buf *bytes.Buffer) ([]byte, bool) {
	l := len(params)
	if l == 0 {
		return emptyBytes, false
	}

	if l == 1 {
		for k, v := range params {
			return []byte(k + "=" + v), false
		}
	}

	var nbuf = buf
	if buf == nil {
		nbuf = bytes.NewBuffer(make([]byte, 0, Bufsize))
	}

	var i int
	for k, v := range params {
		if i != 0 {
			nbuf.WriteByte('&')
		}

		i++
		nbuf.WriteString(k)
		nbuf.WriteByte('=')
		nbuf.WriteString(v)
	}

	return nbuf.Bytes(), buf != nil
}
419486
func ExtractQueryParams(queryParams map[string]interface{}) (query string, args []interface{}) {
	for key, value := range queryParams {
		if query == "" {
			query += key
		} else {
			query += " AND " + key
		}
		args = append(args, value)
	}
	return
}
164302
func (c *Client) Resolved(p params.Resolved) error {
	if err := c.checkCanWrite(); err != nil {
		return err
	}
	if err := c.check.ChangeAllowed(); err != nil {
		return errors.Trace(err)
	}
	unit, err := c.api.stateAccessor.Unit(p.UnitName)
	if err != nil {
		return err
	}
	return unit.Resolve(p.Retry)
}
542240
func (f VariableFilter) QueryParams() map[string][]string {
	qp := url.Values{}
	if f.ID != nil {
		qp.Add("id", f.ID.String())
	}

	if f.OrganizationID != nil {
		qp.Add("orgID", f.OrganizationID.String())
	}

	if f.Organization != nil {
		qp.Add("org", *f.Organization)
	}

	return qp
}
516707
func (stmt *Stmt) QueryContext(c context.Context, model interface{}, params ...interface{}) (Result, error) {
	return stmt.query(c, model, params...)
}
574807
func ContextQueryParams(c *APIContext) map[string][]string {
	qp, ok := c.Get("QueryParams")
	if ok == false {
		qp = make(map[string][]string)
		c.Set("QueryParams", qp)
	}
	return qp.(map[string][]string)
}
1208319
func (r *Registry) LookupParameterInfo(resource, name string) (param SearchParamInfo, err error) {
	r.infosLock.RLock()
	defer r.infosLock.RUnlock()
	param, ok := r.infos[resource][name]
	if !ok {
		return SearchParamInfo{}, fmt.Errorf("Could not find info for parameter %s for resource %s", name, resource)
	}
	return param, nil
}
1092425
func (q *Query) Query(model, query interface{}, params ...interface{}) (Result, error) {
	params = append(params, q.model)
	return q.db.QueryContext(q.ctx, model, query, params...)
}
294987
func (bC *BaseController) QueryMap(r *http.Request, param string) map[string]string {
	mapData := make(map[string]string, 0)
	if vals := r.URL.Query()[param]; len(vals) > 0 {
		for _, unsplitKeyVal := range vals {
			keyVal := strings.SplitN(unsplitKeyVal, ":", 2)
			if len(keyVal) == 2 {
				mapData[keyVal[0]] = keyVal[1]
			} else {
				mapData[keyVal[0]] = ""
			}
		}
	}
	return mapData
}
1110095
func (cr *ConsulResolver) Resolve(ctx context.Context) (string, connect.CertURI, error) {
	switch cr.Type {
	case ConsulResolverTypeService:
		return cr.resolveService(ctx)
	case ConsulResolverTypePreparedQuery:
		return cr.resolveQuery(ctx)
	default:
		return "", nil, fmt.Errorf("unknown resolver type")
	}
}
1215623
func GetReqQueryParam(req *http.Request, headerName string) string {
	return strings.TrimSpace(req.URL.Query().Get(headerName))
}
1178278
func (ctx *Context) QueryInt(key string, defaults ...int) int {
	return (*Queries)(ctx.req).MustInt(key, defaults...)
}