// Mapper interface
423349
func (ms *MapperStruct) NewVal() sophie.Sophier {
	if ms.NewValF != nil {
		return ms.NewValF()
	}
	return new(sophie.RawByteSlice)
}
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
}
203252
func PluginLoader(opts map[string]string) (map[string]interface{}, error) {
	conf := map[string]interface{}{}
	if v, err := strconv.ParseBool(opts["driver.raw_exec.enable"]); err == nil {
		conf["enabled"] = v
	}
	if v, err := strconv.ParseBool(opts["driver.raw_exec.no_cgroups"]); err == nil {
		conf["no_cgroups"] = v
	}
	return conf, nil
}
1299039
func (mapOp *MapOperation) Map(key string) *MapOperation {
	if mapOp.removeMaps != nil {
		delete(mapOp.removeMaps, key)
	}
	if mapOp.maps == nil {
		mapOp.maps = make(map[string]*MapOperation)
	}

	innerMapOp, ok := mapOp.maps[key]
	if ok {
		return innerMapOp
	}

	innerMapOp = &MapOperation{}
	mapOp.maps[key] = innerMapOp
	return innerMapOp
}
33920
func StringMapToUser(data map[string]interface{}) *User {

	ind := &User{}
	for k, v := range data {
		switch k {
		case "FirstName":
			if value, ok := v.(string); ok {
				ind.FirstName = value
			}
		case "LastName":
			if value, ok := v.(string); ok {
				ind.LastName = value
			}
		case "Errors":
			if value, ok := v.(map[string]interface{}); ok {
				for _, item := range value["array"].([]interface{}) {
					ind.Errors = append(ind.Errors, item.(string))
				}
			}
		case "Address":
			if vmap, ok := v.(map[string]interface{}); ok {
				//important need namespace and record name
				if cookieSMap, ok := vmap["my.namespace.com.address"].(map[string]interface{}); ok {
					add := &Address{}
					for k, v := range cookieSMap {
						switch k {
						case "Address1":
							if value, ok := v.(string); ok {
								add.Address1 = value
							}
						case "Address2":
							if value, ok := v.(string); ok {
								add.Address2 = value
							}
						case "City":
							if value, ok := v.(string); ok {
								add.City = value
							}
						case "Zip":
							if value, ok := v.(int); ok {
								add.Zip = value
							}
						}
					}
					ind.Address = add
				}
			}
		}

	}
	return ind

}
365271
func (q *Query) MapScan(m map[string]interface{}) error {
	iter := q.Iter()
	if err := iter.checkErrAndNotFound(); err != nil {
		return err
	}
	iter.MapScan(m)
	return iter.Close()
}
794737
func StrictMapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error {
	cfg, err := Load(source, others...)
	if err != nil {
		return err
	}
	cfg.NameMapper = mapper
	return cfg.StrictMapTo(v)
}
323984
func (m Mapping) Map(r rune) (replacement []rune, ok bool) {
	rs, ok := m[r]
	if !ok {
		return nil, false
	}
	return rs, true
}
82246
func (g *Container) ChildrenMap() (map[string]*Container, error) {
	if mmap, ok := g.Data().(map[string]interface{}); ok {
		children := map[string]*Container{}
		for name, obj := range mmap {
			children[name] = &Container{obj}
		}
		return children, nil
	}
	return nil, ErrNotObj
}
22360
func mapToUser(m map[string]interface{}) *User {
	user := User { }
	for k, v := range m {
		// ignore nil values
		if v == nil {
			continue
		}

		switch k {
		case "login"       : user.Login, _ = v.(string)
		case "type"        : user.Type, _ = v.(string)
		case "name"        : user.Name, _ = v.(string)
		case "email"       : user.Email, _ = v.(string)
		case "company"     : user.Company, _ = v.(string)
		case "location"    : user.Location, _ = v.(string)
		case "avatar_url"  : user.Avatar, _ = v.(string)
		case "gravatar_id" : user.GravatarId, _ = v.(string)
		case "html_url"    : user.Url, _ = v.(string)
		case "id"          :
			if id, ok := v.(float64); ok {
				user.ID = int64(id)
			}
		}
	}

	return &user
}
732910
func (p *PilosaKeyMapper) MapRequest(body []byte) ([]byte, error) {
	log.Printf("mapping request: '%s'", body)
	query, err := pql.ParseString(string(body))
	if err != nil {
		return nil, errors.Wrap(err, "parsing string")
	}
	for _, call := range query.Calls {
		err := p.mapCall(call)
		if err != nil {
			return nil, errors.Wrap(err, "mapping call")
		}
	}
	log.Printf("mapped request: '%s'", query.String())
	return []byte(query.String()), nil
}
83459
func MatchMap(buf []byte, matchers matchers.Map) types.Type {
	for kind, matcher := range matchers {
		if matcher(buf) {
			return kind
		}
	}
	return types.Unknown
}
128035
func (p *PilosaKeyMapper) MapResult(field string, res interface{}) (mappedRes interface{}, err error) {
	log.Printf("mapping result: '%#v'", res)
	defer func() {
		log.Printf("mapped result: '%#v'", mappedRes)
	}()
	switch result := res.(type) {
	case uint64:
		// Count
		mappedRes = result
	case []interface{}:
		return p.mapSliceInterfaceResult(field, result)
	case map[string]interface{}:
		// Bitmap/Intersect/Difference/Union
		return p.mapBitmapResult(field, result)
	case bool:
		// SetBit/ClearBit
		mappedRes = result
	default:
		// Range? SetRowAttrs?
		mappedRes = result
	}
	return mappedRes, nil
}
677118
func mapFieldKeys(m map[*descriptor.FieldDescriptorProto]string) []*descriptor.FieldDescriptorProto {
	keys := make([]*descriptor.FieldDescriptorProto, 0, len(m))
	for k := range m {
		keys = append(keys, k)
	}
	sort.Sort(byTypeName(keys))
	return keys
}
511800
func newMapping(prof *profile.Profile, obj plugin.ObjTool, ui plugin.UI, force bool) (*mappingTable, error) {
	mt := &mappingTable{
		prof:     prof,
		segments: make(map[*profile.Mapping]plugin.ObjFile),
	}

	// Identify used mappings
	mappings := make(map[*profile.Mapping]bool)
	for _, l := range prof.Location {
		mappings[l.Mapping] = true
	}

	missingBinaries := false
	for midx, m := range prof.Mapping {
		if !mappings[m] {
			continue
		}

		// Do not attempt to re-symbolize a mapping that has already been symbolized.
		if !force && (m.HasFunctions || m.HasFilenames || m.HasLineNumbers) {
			continue
		}

		if m.File == "" {
			if midx == 0 {
				ui.PrintErr("Main binary filename not available.")
				continue
			}
			missingBinaries = true
			continue
		}

		// Skip well-known system mappings
		if m.Unsymbolizable() {
			continue
		}

		// Skip mappings pointing to a source URL
		if m.BuildID == "" {
			if u, err := url.Parse(m.File); err == nil && u.IsAbs() && strings.Contains(strings.ToLower(u.Scheme), "http") {
				continue
			}
		}

		name := filepath.Base(m.File)
		f, err := obj.Open(m.File, m.Start, m.Limit, m.Offset)
		if err != nil {
			ui.PrintErr("Local symbolization failed for ", name, ": ", err)
			missingBinaries = true
			continue
		}
		if fid := f.BuildID(); m.BuildID != "" && fid != "" && fid != m.BuildID {
			ui.PrintErr("Local symbolization failed for ", name, ": build ID mismatch")
			f.Close()
			continue
		}

		mt.segments[m] = f
	}
	if missingBinaries {
		ui.PrintErr("Some binary filenames not available. Symbolization may be incomplete.\n" +
			"Try setting PPROF_BINARY_PATH to the search path for local binaries.")
	}
	return mt, nil
}
690962
func (oms *OnlyMapperStruct) MapEnd(c []sophie.Collector) error {
	if oms.MapEndF != nil {
		return oms.MapEndF(c)
	}
	return nil
}
687003
func AsMap(obj interface{}, includeGlobals bool) context.Map {
	return cm.AsMap(obj, includeGlobals)
}