// getArray converts schema to an *proto.Array object
556224
func getArray(schema proto.Schema) (*proto.Array, error) {
	if schema == nil {
		return nil, nil
	}
	visitor := &arraySchemaVisitor{}
	schema.Accept(visitor)
	return visitor.Result, visitor.Err
}
741792
func (env *Environment) GetArray(key string, overrideDefault *[]string) ([]string, error) {
	var oD *string
	if overrideDefault != nil {
		if len(*overrideDefault) > 0 {
			ovr := (*overrideDefault)[0]
			oD = &ovr
		}
	}
	v, e := env.Get(key, oD)
	arr := []string{v}

	if env.supportArrays {
		if strings.Contains(v, ",") {
			arr = strings.Split(v, ",")
		}
	}

	if len(v) > 0 {
		return arr, e
	}
	return []string{}, e
}
975990
func (reader PluginConfigReaderWithError) GetFilterArray(key string, logger logrus.FieldLogger,
	defaultValue FilterArray) (FilterArray, error) {
	filters := []Filter{}

	modPlugins, err := reader.GetPluginArray(key, []Plugin{})
	if err != nil {
		return filters, err
	}
	if len(modPlugins) == 0 {
		return filters, nil
	}

	errors := tgo.NewErrorStack()
	errors.SetFormat(tgo.ErrorStackFormatCSV)

	for _, plugin := range modPlugins {
		if filter, isFilter := plugin.(Filter); isFilter {
			filters = append(filters, filter)
		} else {
			errors.Pushf("Plugin '%T' is not a valid filter", plugin)
			panic(errors.Top())
		}
	}

	return filters, errors.OrNil()
}
389917
func (p *parser) typeOfArray(types []tomlType) tomlType {
	// Empty arrays are cool.
	if len(types) == 0 {
		return tomlArray
	}

	theType := types[0]
	for _, t := range types[1:] {
		if !typeEqual(theType, t) {
			p.panicf("Array contains values of type '%s' and '%s', but "+
				"arrays must be homogeneous.", theType, t)
		}
	}
	return tomlArray
}
851138
func (c *Context) GetPostFormArray(key string) ([]string, bool) {
	req := c.Request
	if err := req.ParseMultipartForm(c.engine.MaxMultipartMemory); err != nil {
		if err != http.ErrNotMultipart {
			debugPrint("error on parse multipart form array: %v", err)
		}
	}
	if values := req.PostForm[key]; len(values) > 0 {
		return values, true
	}
	if req.MultipartForm != nil && req.MultipartForm.File != nil {
		if values := req.MultipartForm.Value[key]; len(values) > 0 {
			return values, true
		}
	}
	return []string{}, false
}
256520
func bindArray(bindType int, query string, arg interface{}, m *reflectx.Mapper) (string, []interface{}, error) {
	// do the initial binding with QUESTION;  if bindType is not question,
	// we can rebind it at the end.
	bound, names, err := compileNamedQuery([]byte(query), QUESTION)
	if err != nil {
		return "", []interface{}{}, err
	}
	arrayValue := reflect.ValueOf(arg)
	arrayLen := arrayValue.Len()
	if arrayLen == 0 {
		return "", []interface{}{}, fmt.Errorf("length of array is 0: %#v", arg)
	}
	var arglist []interface{}
	for i := 0; i < arrayLen; i++ {
		elemArglist, err := bindArgs(names, arrayValue.Index(i).Interface(), m)
		if err != nil {
			return "", []interface{}{}, err
		}
		arglist = append(arglist, elemArglist...)
	}
	if arrayLen > 1 {
		bound = fixBound(bound, arrayLen)
	}
	// adjust binding type if we weren't on question
	if bindType != QUESTION {
		bound = Rebind(bindType, bound)
	}
	return bound, arglist, nil
}
79848
func DecodeArray(data []byte) ([]interface{}, error) {
	d := NewDecoder(data)
	if c := d.skipSpaces(); c != '[' {
		return nil, d.error(c, "looking for beginning of array")
	}
	val, err := d.array()
	if err != nil {
		return nil, err
	}
	if c := d.skipSpaces(); d.pos < d.end {
		return nil, d.error(c, "after top-level value")
	}
	return val, nil
}
289515
func (agent *ActionAgent) GetSchema(ctx context.Context, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) {
	return agent.MysqlDaemon.GetSchema(topoproto.TabletDbName(agent.Tablet()), tables, excludeTables, includeViews)
}
150458
func (d *decodeState) array(v reflect.Value) {
	// Check for unmarshaler.

	u, ut, pv := d.indirect(v, false)
	if u != nil {
		err := u.UnmarshalJSON(d.next())
		if err != nil {
			d.error(err)
		}
		return
	}
	if ut != nil {
		d.saveError(&UnmarshalTypeError{"array", v.Type(), int64(d.peekPos() + 1)})
		d.next()
		return
	}

	v = pv

	// Check type of target.
	switch v.Kind() {
	case reflect.Interface:
		if v.NumMethod() == 0 {
			// Decoding into nil interface?  Switch to non-reflect code.
			v.Set(reflect.ValueOf(d.arrayInterface()))
			return
		}
		// Otherwise it's invalid.
		fallthrough
	default:
		d.saveError(&UnmarshalTypeError{"array", v.Type(), int64(d.peekPos() + 1)})
		d.next()
		return
	case reflect.Array:
	case reflect.Slice:
		break
	}
	d.skipRecord() //skip [
	i := 0
	for {
		// Look ahead for ] - can only happen on first iteration.
		op := d.peekState()
		if op == scanEndArray {
			d.skipRecord()

			break
		}
		if op != scanBeginLiteral && op != scanBeginObject && op != scanBeginArray {
			d.error(errPhase)
		}

		// Get element of array, growing if necessary.
		if v.Kind() == reflect.Slice {
			// Grow slice if necessary
			if i >= v.Cap() {
				newcap := v.Cap() + v.Cap()/2
				if newcap < 4 {
					newcap = 4
				}
				newv := reflect.MakeSlice(v.Type(), v.Len(), newcap)
				reflect.Copy(newv, v)
				v.Set(newv)
			}
			if i >= v.Len() {
				v.SetLen(i + 1)
			}
		}

		if i < v.Len() {
			// Decode into element.
			d.value(v.Index(i))
		} else {
			// Ran out of fixed array: skip.
			d.value(reflect.Value{})
		}
		i++

	}

	if i < v.Len() {
		if v.Kind() == reflect.Array {
			// Array. Zero the rest.
			z := reflect.Zero(v.Type().Elem())
			for ; i < v.Len(); i++ {
				v.Index(i).Set(z)
			}
		} else {
			v.SetLen(i)
		}
	}
	if i == 0 && v.Kind() == reflect.Slice {
		v.Set(reflect.MakeSlice(v.Type(), 0, 0))
	}
}
1348292
func (c *Context) PostFormArray(key string) []string {
	values, _ := c.GetPostFormArray(key)
	return values
}
1259514
func (reader PluginConfigReaderWithError) GetStreamArray(key string, defaultValue []MessageStreamID) ([]MessageStreamID, error) {
	key = reader.config.registerKey(key)
	if reader.HasValue(key) {
		values, err := reader.GetStringArray(key, []string{})
		if err != nil {
			return nil, err
		}
		streamArray := []MessageStreamID{}
		for _, streamName := range values {
			streamArray = append(streamArray, GetStreamID(streamName))
		}
		return streamArray, nil
	}

	return defaultValue, nil
}
1194536
func pcfArray(val []interface{}) (string, error) {
	items := make([]string, len(val))
	for i, el := range val {
		p, err := parsingCanonicalForm(el)
		if err != nil {
			return "", err
		}
		items[i] = p
	}
	return "[" + strings.Join(items, ",") + "]", nil
}
337836
func (c *Context) GetQueryArray(key string) ([]string, bool) {
	if values, ok := c.Request.URL.Query()[key]; ok && len(values) > 0 {
		return values, true
	}
	return []string{}, false
}
1117554
func safeArrayGetElement(safearray *SafeArray, index int32, pv unsafe.Pointer) error {
	return convertHresultToError(
		procSafeArrayGetElement.Call(
			uintptr(unsafe.Pointer(safearray)),
			uintptr(unsafe.Pointer(&index)),
			uintptr(pv)))
}
288713
func (s *LDBStore) GetSchema() (string, error) {
	s.lock.Lock()
	defer s.lock.Unlock()

	data, err := s.db.Get(keySchema)
	if err != nil {
		if err == leveldb.ErrNotFound {
			return DbSchemaNone, nil
		}
		return "", err
	}

	return string(data), nil
}
493506
func ArrayToCFArray(a []C.CFTypeRef) C.CFArrayRef {
	var values []C.uintptr_t
	for _, value := range a {
		values = append(values, C.uintptr_t(value))
	}
	numValues := len(values)
	var valuesPointer *C.uintptr_t
	if numValues > 0 {
		valuesPointer = &values[0]
	}
	return C.CFArrayCreateSafe2(C.kCFAllocatorDefault, valuesPointer, C.CFIndex(numValues), &C.kCFTypeArrayCallBacks)
}
1307725
func (s *Set) ToArray() []interface{} {
	s.lock.RLock()
	defer s.lock.RUnlock()
	a := make([]interface{}, len(s.items))
	i := 0
	for item := range s.items {
		a[i] = item
		i++
	}
	return a
}