// formValues extracts the form data.
771666
func formValues(r *http.Request) (map[string]interface{}, *search.Options) {
	fv := make(map[string]interface{})
	var options search.Options

	fv["searchterm"] = r.FormValue("searchterm")
	options.SearchTerm = r.FormValue("searchterm")

	if r.FormValue("google") == "on" {
		fv["google"] = "checked"
		options.Google = true
	} else {
		fv["google"] = ""
	}

	if r.FormValue("bing") == "on" {
		fv["bing"] = "checked"
		options.Bing = true
	} else {
		fv["bing"] = ""
	}

	if r.FormValue("blekko") == "on" {
		fv["blekko"] = "checked"
		options.Blekko = true
	} else {
		fv["blekko"] = ""
	}

	if r.FormValue("first") == "on" {
		fv["first"] = "checked"
		options.First = true
	} else {
		fv["first"] = ""
	}

	return fv, &options
}
139105
func (c *BotsInfoCall) FromValues(v url.Values) error {
	var tmp BotsInfoCall
	if raw := strings.TrimSpace(v.Get("bot")); len(raw) > 0 {
		tmp.bot = raw
	}
	*c = tmp
	return nil
}
644153
func (d *Dataset) InsertValues(index int, values ...interface{}) error {
	return d.Insert(index, values[:])
}
449903
func (d *Database) SomeValues(src interface{}, columns []string) ([]interface{}, error) {
	data, err := getFields(reflect.TypeOf(src))
	if err != nil {
		return nil, err
	}
	structVal := reflect.ValueOf(src).Elem()

	var values []interface{}
	for _, name := range columns {
		field, present := data.fields[name]
		if !present {
			// write null to the database
			values = append(values, nil)

			if Debug {
				log.Printf("meddler.SomeValues: column [%s] not found in struct", name)
			}
			continue
		}

		saveVal, err := field.meddler.PreWrite(structVal.Field(field.index).Interface())
		if err != nil {
			return nil, fmt.Errorf("meddler.SomeValues: PreWrite error on column [%s]: %v", name, err)
		}
		values = append(values, saveVal)
	}

	return values, nil
}
10902
func addFormValues(opt map[string]string) *url.Values {
	uv := url.Values{}
	for k, v := range opt {
		uv.Set(k, v)
	}
	return &uv
}
225495
func FormNames(s string) []string {
	var res []string
	hasLeft := false
	hasRight := true
	var val []rune
	for _, r := range s {
		if r == '[' {
			if hasRight {
				res = append(res, string(val))
				val = []rune{}
			}
			hasLeft = true
			hasRight = false
			continue
		}
		if r == ']' {
			if hasLeft {
				res = append(res, string(val))
				val = []rune{}
				hasLeft = false
			}
			continue
		}
		val = append(val, r)
	}
	if len(val) > 0 {
		res = append(res, string(val))
	}
	return res
}
537133
func (ctx *Context) FormStrings(key string, defaults ...[]string) []string {
	return (*Forms)(ctx.req).MustStrings(key, defaults...)
}
1129491
func (r *Reader) LabelValues(names ...string) (StringTuples, error) {

	key := strings.Join(names, labelNameSeperator)
	off, ok := r.labels[key]
	if !ok {
		// XXX(fabxc): hot fix. Should return a partial data error and handle cases
		// where the entire block has no data gracefully.
		return emptyStringTuples{}, nil
		//return nil, fmt.Errorf("label index doesn't exist")
	}

	d := encoding.NewDecbufAt(r.b, int(off), castagnoliTable)

	nc := d.Be32int()
	d.Be32() // consume unused value entry count.

	if d.Err() != nil {
		return nil, errors.Wrap(d.Err(), "read label value index")
	}
	st := &serializedStringTuples{
		idsCount: nc,
		idsBytes: d.Get(),
		lookup:   r.lookupSymbol,
	}
	return st, nil
}
49769
func (ts TimeSeries) GetValues(index int) (x, y float64) {
	x = util.Time.ToFloat64(ts.XValues[index])
	y = ts.YValues[index]
	return
}
1202412
func bindValues(keyvals []interface{}) {
	for i := 1; i < len(keyvals); i += 2 {
		if v, ok := keyvals[i].(Valuer); ok {
			keyvals[i] = v()
		}
	}
}
1208578
func (c *Client) GetValues(id string) (vals DimensionValues, err error) {
	uri := fmt.Sprintf("%s/code-lists/%s/codes", c.url, id)

	clientlog.Do(context.Background(), "retrieving codes from codelist", service, uri)

	resp, err := c.cli.Get(context.Background(), uri)
	if err != nil {
		return
	}

	if resp.StatusCode != http.StatusOK {
		err = &ErrInvalidCodelistAPIResponse{http.StatusOK, resp.StatusCode, uri}
		return
	}

	b, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return
	}
	defer resp.Body.Close()

	err = json.Unmarshal(b, &vals)
	return
}
38709
func (t *tikvHandlerTool) formValue2DatumRow(sc *stmtctx.StatementContext, values url.Values, idxCols []*model.ColumnInfo) ([]types.Datum, error) {
	data := make([]types.Datum, len(idxCols))
	for i, col := range idxCols {
		colName := col.Name.String()
		vals, ok := values[colName]
		if !ok {
			return nil, errors.BadRequestf("Missing value for index column %s.", colName)
		}

		switch len(vals) {
		case 0:
			data[i].SetNull()
		case 1:
			bDatum := types.NewStringDatum(vals[0])
			cDatum, err := bDatum.ConvertTo(sc, &col.FieldType)
			if err != nil {
				return nil, errors.Trace(err)
			}
			data[i] = cDatum
		default:
			return nil, errors.BadRequestf("Invalid query form for column '%s', it's values are %v."+
				" Column value should be unique for one index record.", colName, vals)
		}
	}
	return data, nil
}
882078
func (a *AttributeDefinition) AddValues(values []interface{}) {
	if a.Validation == nil {
		a.Validation = &dslengine.ValidationDefinition{}
	}
	a.Validation.Values = make([]interface{}, len(values))
	for i, v := range values {
		switch actual := v.(type) {
		case HashVal:
			a.Validation.Values[i] = actual.ToMap()
		case ArrayVal:
			a.Validation.Values[i] = actual.ToSlice()
		default:
			a.Validation.Values[i] = actual
		}
	}
}
1251866
func (f *Feed) AppendValues(values Values) {
	values.Set("topic", f.Topic.Hex())
	values.Set("user", f.User.Hex())
}
1207608
func (q *Query) FromValues(values Values) error {
	time, _ := strconv.ParseUint(values.Get("time"), 10, 64)
	q.TimeLimit = time

	level, _ := strconv.ParseUint(values.Get("hint.level"), 10, 32)
	q.Hint.Level = uint8(level)
	q.Hint.Time, _ = strconv.ParseUint(values.Get("hint.time"), 10, 64)
	if q.Feed.User == (common.Address{}) {
		return q.Feed.FromValues(values)
	}
	return nil
}
539007
func (v *Vars) ClearValues() {
	for _, s := range v.scopes {
		s.values = nil
	}
}
1011063
func (s *SetDimension) SetValues(v []*string) *SetDimension {
	s.Values = v
	return s
}