// MarshalQueryParameter converts to a URL query parameter value
504900
func (t MicroTime) MarshalQueryParameter() (string, error) {
	if t.IsZero() {
		// Encode unset/nil objects as an empty string
		return "", nil
	}

	return t.UTC().Format(RFC3339Micro), nil
}
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)
}
980367
func (p TXParamSetupReqPayload) MarshalBinary() ([]byte, error) {
	var b uint8
	for i, v := range []uint8{8, 10, 12, 13, 14, 16, 18, 20, 21, 24, 26, 27, 29, 30, 33, 36} {
		if v == p.MaxEIRP {
			b = uint8(i)
		}
	}
	if b == 0 {
		return nil, errors.New("lorawan: invalid MaxEIRP value")
	}

	if p.UplinkDwellTime == DwellTime400ms {
		b = b ^ (1 << 4)
	}
	if p.DownlinkDwelltime == DwellTime400ms {
		b = b ^ (1 << 5)
	}

	return []byte{b}, nil
}
564969
func (v startMessageParams) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson639f989aEncodeCodeCloudfoundryOrgGorouterMbus(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
1203687
func (e Enclosure) MarshalJSON() ([]byte, error) {
	ge := &struct {
		URL    string `json:"url"`
		Length int64  `json:"length"`
		Type   string `json:"type"`
	}{
		URL:    e.URL,
		Length: e.Length,
		Type:   e.Type,
	}
	return json.Marshal(ge)
}
99672
func (o *QueryOptions) URLQueryParameters() URLQueryParameters {
	var queryParams URLQueryParameters
	if o.IsSTU3Sort {
		keys := make([]string, len(o.Sort))
		for i := range o.Sort {
			if o.Sort[i].Descending {
				keys[i] = fmt.Sprintf("-%s", o.Sort[i].Parameter.Name)
			} else {
				keys[i] = o.Sort[i].Parameter.Name
			}
		}
		queryParams.Add(SortParam, strings.Join(keys, ","))
	} else {
		for _, sort := range o.Sort {
			sortParamKey := SortParam
			if sort.Descending {
				sortParamKey += ":desc"
			}
			queryParams.Add(sortParamKey, sort.Parameter.Name)
		}
	}
	queryParams.Set(OffsetParam, strconv.Itoa(o.Offset))
	queryParams.Set(CountParam, strconv.Itoa(o.Count))
	for _, incl := range o.Include {
		queryParams.Add(IncludeParam, fmt.Sprintf("%s:%s", incl.Resource, incl.Parameter.Name))
	}
	for _, incl := range o.RevInclude {
		queryParams.Add(RevIncludeParam, fmt.Sprintf("%s:%s", incl.Resource, incl.Parameter.Name))
	}
	return queryParams
}
470369
func (m *SwaggerJwkSetQuery) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
460589
func AddQueryParameters(baseURL string, queryParams map[string]string) string {
	baseURL += "?"
	params := url.Values{}
	for key, value := range queryParams {
		params.Add(key, value)
	}
	return baseURL + params.Encode()
}
482153
func (p *StateInitializationParams) Marshal() ([]byte, error) {
	customImageMetadataJSON, err := json.Marshal(p.CustomImageMetadata)
	if err != nil {
		return nil, errors.Annotate(err, "marshalling custom image metadata")
	}
	controllerCloud, err := cloud.MarshalCloud(p.ControllerCloud)
	if err != nil {
		return nil, errors.Annotate(err, "marshalling cloud definition")
	}
	internal := stateInitializationParamsInternal{
		p.ControllerConfig,
		p.ControllerModelConfig.AllAttrs(),
		p.ControllerModelEnvironVersion,
		p.ControllerInheritedConfig,
		p.RegionInheritedConfig,
		p.HostedModelConfig,
		p.BootstrapMachineInstanceId,
		p.BootstrapMachineConstraints,
		p.BootstrapMachineHardwareCharacteristics,
		p.ModelConstraints,
		string(customImageMetadataJSON),
		string(controllerCloud),
		p.ControllerCloudRegion,
		p.ControllerCloudCredentialName,
		p.ControllerCloudCredential,
	}
	return yaml.Marshal(&internal)
}
21571
func (m *Method) inheritQueryParams(parents map[string]NamedParameter, dicts map[string]interface{}) {
	if len(m.QueryParameters) == 0 {
		m.QueryParameters = map[string]NamedParameter{}
	}
	for name, parent := range parents {
		qp, ok := m.QueryParameters[name]
		if !ok {
			if optionalTraitProperty(string(name)) { // don't inherit optional property if not exist
				continue
			}
			qp = NamedParameter{Name: name}
		}
		parent.Name = name // parent name is not initialized by the parser
		qp.inherit(parent, dicts)
		m.QueryParameters[qp.Name] = qp
	}

}
1299492
func (r *SearchRequest) MarshalJSON() ([]byte, error) {
	root := make(map[string]interface{})

	root["size"] = r.Size
	if len(r.Sort) > 0 {
		root["sort"] = r.Sort
	}

	for key, value := range r.CustomProps {
		root[key] = value
	}

	root["query"] = r.Query

	if len(r.Aggs) > 0 {
		root["aggs"] = r.Aggs
	}

	return json.Marshal(root)
}
1182124
func (u URL) MarshalBinary() ([]byte, error) {
	uu := url.URL(u)
	return []byte(uu.String()), nil
}
699532
func (se *SimpleElement) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
	return e.EncodeElement(xml.CharData(se.value), se.StartElement)
}
761357
func QueryParam(name, value string) Option {
	return optionFunc(func(base string, v url.Values) string {
		v.Set(name, value)
		return base
	})
}
1316851
func messageToQueryParameters(message *descriptor.Message, reg *descriptor.Registry, pathParams []descriptor.Parameter) (params []swaggerParameterObject, err error) {
	for _, field := range message.Fields {
		p, err := queryParams(message, field, "", reg, pathParams)
		if err != nil {
			return nil, err
		}
		params = append(params, p...)
	}
	return params, nil
}
320417
func (route *Route) MarshalJSON() ([]byte, error) {
	var vindexName string
	if route.Vindex != nil {
		vindexName = route.Vindex.String()
	}
	marshalRoute := struct {
		Opcode                  RouteOpcode
		Keyspace                *vindexes.Keyspace   `json:",omitempty"`
		Query                   string               `json:",omitempty"`
		FieldQuery              string               `json:",omitempty"`
		Vindex                  string               `json:",omitempty"`
		Values                  []sqltypes.PlanValue `json:",omitempty"`
		OrderBy                 []OrderbyParams      `json:",omitempty"`
		TruncateColumnCount     int                  `json:",omitempty"`
		QueryTimeout            int                  `json:",omitempty"`
		ScatterErrorsAsWarnings bool                 `json:",omitempty"`
	}{
		Opcode:                  route.Opcode,
		Keyspace:                route.Keyspace,
		Query:                   route.Query,
		FieldQuery:              route.FieldQuery,
		Vindex:                  vindexName,
		Values:                  route.Values,
		OrderBy:                 route.OrderBy,
		TruncateColumnCount:     route.TruncateColumnCount,
		QueryTimeout:            route.QueryTimeout,
		ScatterErrorsAsWarnings: route.ScatterErrorsAsWarnings,
	}
	return jsonutil.MarshalNoEscape(marshalRoute)
}
849216
func (rc *RequestContext) MarshalJSON() ([]byte, error) {
	return json.Marshal(&jsonRequestContext{
		(*requestContextAlias)(rc),
		rc.Authorizer,
	})
}