// defaultQueryOptions returns a queryOptions set to package-level defaults.
320550
func defaultQueryOptions() *queryOptions {
	return &queryOptions{
		timeout:            QueryTimeout,
		numRetries:         uint8(QueryNumRetries),
		peerConnectTimeout: QueryPeerConnectTimeout,
		encoding:           QueryEncoding,
		optimisticBatch:    noBatch,
	}
}
78082
func (r *request) setQueryOptions(q *QueryOptions) {
	if q == nil {
		return
	}
	if q.Region != "" {
		r.params.Set("region", q.Region)
	}
	if q.Namespace != "" {
		r.params.Set("namespace", q.Namespace)
	}
	if q.AuthToken != "" {
		r.token = q.AuthToken
	}
	if q.AllowStale {
		r.params.Set("stale", "")
	}
	if q.WaitIndex != 0 {
		r.params.Set("index", strconv.FormatUint(q.WaitIndex, 10))
	}
	if q.WaitTime != 0 {
		r.params.Set("wait", durToMsec(q.WaitTime))
	}
	if q.Prefix != "" {
		r.params.Set("prefix", q.Prefix)
	}
	for k, v := range q.Params {
		r.params.Set(k, v)
	}
}
78965
func (s *CreateJobInput) SetDefaultArguments(v map[string]*string) *CreateJobInput {
	s.DefaultArguments = v
	return s
}
729306
func (c *Context) QueryIntWithDefault(key string, defaultValue int) (int, error) {
	data := c.Query(key)
	if len(data) > 0 {
		return strconv.Atoi(c.Query(key))
	}
	return defaultValue, nil
}
55265
func DefaultVerifyOptions() x509.VerifyOptions {
	return x509.VerifyOptions{
		KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
	}
}
53866
func Query(query url.Values) RequestOption {
	return func(req *http.Request) error {
		req.URL.RawQuery = query.Encode()
		return nil
	}
}
290279
func (client *QueryClient) ExecuteWithOptions(query string, bindvars map[string]*querypb.BindVariable, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
	return client.server.Execute(
		client.ctx,
		&client.target,
		query,
		bindvars,
		client.transactionID,
		options,
	)
}
181819
func defaultQuery() HostComputeQuery {
	query := HostComputeQuery{
		SchemaVersion: SchemaVersion{
			Major: 2,
			Minor: 0,
		},
		Flags: HostComputeQueryFlagsNone,
	}
	return query
}
228256
func (a *ArgClause) Default(values ...string) *ArgClause {
	a.defaultValues = values
	return a
}
935976
func SetDefaultString(in string) stringRuleOpt {
	return func(i *rpc.StringRule) {
		i.Default = in
		i.HasDefault = true
	}
}
1052692
func applyAdditionalQueryOptions(queryString string, queryLimit int32, queryBookmark string) (string, error) {
	const jsonQueryFields = "fields"
	const jsonQueryLimit = "limit"
	const jsonQueryBookmark = "bookmark"
	//create a generic map for the query json
	jsonQueryMap := make(map[string]interface{})
	//unmarshal the selector json into the generic map
	decoder := json.NewDecoder(bytes.NewBuffer([]byte(queryString)))
	decoder.UseNumber()
	err := decoder.Decode(&jsonQueryMap)
	if err != nil {
		return "", err
	}
	if fieldsJSONArray, ok := jsonQueryMap[jsonQueryFields]; ok {
		switch fieldsJSONArray.(type) {
		case []interface{}:
			//Add the "_id", and "version" fields,  these are needed by default
			jsonQueryMap[jsonQueryFields] = append(fieldsJSONArray.([]interface{}),
				idField, versionField)
		default:
			return "", errors.New("fields definition must be an array")
		}
	}
	// Add limit
	// This will override any limit passed in the query.
	// Explicit paging not yet supported.
	jsonQueryMap[jsonQueryLimit] = queryLimit
	// Add the bookmark if provided
	if queryBookmark != "" {
		jsonQueryMap[jsonQueryBookmark] = queryBookmark
	}
	//Marshal the updated json query
	editedQuery, err := json.Marshal(jsonQueryMap)
	if err != nil {
		return "", err
	}
	logger.Debugf("Rewritten query: %s", editedQuery)
	return string(editedQuery), nil
}
736307
func (qo *queryOptions) applyQueryOptions(options ...QueryOption) {
	for _, option := range options {
		option(qo)
	}
}
697387
func SQLAllOptions(opts *SQLStoreOptions) SQLStoreOption {
	return func(o *SQLStoreOptions) error {
		o.NoCaching = opts.NoCaching
		o.MaxOpenConns = opts.MaxOpenConns
		return nil
	}
}
1061575
func (a *Application) defaultEndpointBindings() (map[string]string, error) {
	if a.doc.CharmURL == nil {
		return map[string]string{}, nil
	}

	appCharm, _, err := a.Charm()
	if err != nil {
		return nil, errors.Trace(err)
	}

	return DefaultEndpointBindingsForCharm(appCharm.Meta()), nil
}
959683
func (s *Stage) SetDefaultRouteSettings(v *RouteSettings) *Stage {
	s.DefaultRouteSettings = v
	return s
}
626581
func (q *Query) Options() *QueryOptions {
	options := NewQueryOptions()
	queryParams, _ := ParseQuery(q.Query)
	for _, queryParam := range queryParams.All() {
		param, modifier, _ := ParseParamNameModifierAndPostFix(queryParam.Key)
		if !strings.HasPrefix(param, "_") || isGlobalSearchParam(param) {
			continue
		}

		switch param {

		case CountParam:
			count, err := strconv.Atoi(queryParam.Value)
			if err != nil {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_count\" content is invalid"))
			}
			if count >= 0 {
				options.Count = count
			}

		case OffsetParam:
			offset, err := strconv.Atoi(queryParam.Value)
			if err != nil {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_offset\" content is invalid"))
			}
			if offset >= 0 {
				options.Offset = offset
			}

		case SortParam:
			// The following supports both DSTU2-style sorts and STU3-style sorts
			keys := strings.Split(queryParam.Value, ",")
			for _, key := range keys {
				desc := strings.HasPrefix(key, "-") || modifier == "desc"
				sortParam, ok := SearchParameterDictionary[q.Resource][strings.TrimPrefix(key, "-")]
				if !ok {
					panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_sort\" content is invalid"))
				}
				options.Sort = append(options.Sort, SortOption{Descending: desc, Parameter: sortParam})
			}
			// If this was an STU3-style sort, remember that so we reconstruct the query URL correctly
			if len(keys) > 1 || strings.HasPrefix(queryParam.Value, "-") {
				options.IsSTU3Sort = true
			}

		case IncludeParam:
			incls := strings.Split(queryParam.Value, ":")
			if len(incls) < 2 || len(incls) > 3 {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_include\" content is invalid"))
			}
			inclParam, ok := SearchParameterDictionary[incls[0]][incls[1]]
			if !ok {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_include\" content is invalid"))
			}
			// Only reference paramaters count, so verify it is a reference parameter
			if inclParam.Type != "reference" {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_include\" content is invalid"))
			}
			if len(incls) == 3 {
				if isValidTarget(incls[2], inclParam) {
					// Modify the targets to include only the one noted
					inclParam.Targets = []string{incls[2]}
				} else {
					panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_include\" content is invalid"))
				}
			}
			options.Include = append(options.Include, IncludeOption{Resource: incls[0], Parameter: inclParam})

		case RevIncludeParam:
			incls := strings.Split(queryParam.Value, ":")
			if len(incls) < 2 || len(incls) > 3 {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_revinclude\" content is invalid"))
			}
			revInclParam, ok := SearchParameterDictionary[incls[0]][incls[1]]
			if !ok {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_revinclude\" content is invalid"))
			}
			// Only reference paramaters count, so verify it is a reference parameter
			if revInclParam.Type != "reference" {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_revinclude\" content is invalid"))
			}
			// Only the currently searched on resource is a valid target (or "Any")
			target := q.Resource
			if len(incls) == 3 && incls[2] != target && incls[2] != "Any" {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_revinclude\" content is invalid"))
			}
			// Make sure the selected param actually supports the intended target
			if isValidTarget(target, revInclParam) {
				// Modify the targets to include only the resource we're searching on
				revInclParam.Targets = []string{target}
			} else {
				panic(createInvalidSearchError("MSG_PARAM_INVALID", "Parameter \"_revinclude\" content is invalid"))
			}
			options.RevInclude = append(options.RevInclude, RevIncludeOption{Resource: incls[0], Parameter: revInclParam})

		case FormatParam:
			if queryParam.Value != "json" && queryParam.Value != "application/json" && queryParam.Value != "application/json+fhir" {
				// Currently we only support JSON
				panic(createUnsupportedSearchError("MSG_PARAM_INVALID", "Parameter \"_format\" content is invalid"))
			}

		default:
			panic(createUnsupportedSearchError("MSG_PARAM_UNKNOWN", fmt.Sprintf("Parameter \"%s\" not understood", param)))
		}
	}
	return options
}
1020406
func (r Product_Package_Server_Option) GetOptions(typ *string) (resp []datatypes.Product_Package_Server_Option, err error) {
	params := []interface{}{
		typ,
	}
	err = r.Session.DoRequest("SoftLayer_Product_Package_Server_Option", "getOptions", params, &r.Options, &resp)
	return
}