// ByKey sorts map by keys in the ascending order
499007
func ByKey(m interface{}) Items {
	ls := getLess(reflect.ValueOf(m).Type().Key())
	return ByFunc(m, func(x, y Item) bool { return ls(x.Key, y.Key) })
}
504431
func (s *GetAggregateConfigRuleComplianceSummaryInput) SetGroupByKey(v string) *GetAggregateConfigRuleComplianceSummaryInput {
	s.GroupByKey = &v
	return s
}
618644
func (f *FileStore) getPathByKey(key string) string {
	return filepath.Join(f.directoryPath, key)
}
717451
func (o Options) sortedKeys() []int {
	// Send all values for a given key
	var codes []int
	for k := range o {
		codes = append(codes, int(k))
	}

	sort.Sort(sort.IntSlice(codes))
	return codes
}
1161444
func (i *ObjectIterator) Key(translate bool) (Slice, error) {
	if i.position >= i.size {
		return nil, WithStack(IndexOutOfBoundsError)
	}
	if current := i.current; current != nil {
		if translate {
			key, err := current.makeKey()
			return key, WithStack(err)
		}
		return current, nil
	}
	key, err := i.s.getNthKey(i.position, translate)
	return key, WithStack(err)
}
926657
func (builder *UpdateCounterCommandBuilder) WithKey(key string) *UpdateCounterCommandBuilder {
	builder.key = key
	return builder
}
247051
func (p Pages) ByParam(paramsKey interface{}) Pages {
	paramsKeyStr := cast.ToString(paramsKey)
	key := "pageSort.ByParam." + paramsKeyStr

	paramsKeyComparator := func(p1, p2 Page) bool {
		v1, _ := p1.Param(paramsKeyStr)
		v2, _ := p2.Param(paramsKeyStr)

		if v1 == nil {
			return false
		}

		if v2 == nil {
			return true
		}

		isNumeric := func(v interface{}) bool {
			switch v.(type) {
			case uint8, uint16, uint32, uint64, int, int8, int16, int32, int64, float32, float64:
				return true
			default:
				return false
			}
		}

		if isNumeric(v1) && isNumeric(v2) {
			return cast.ToFloat64(v1) < cast.ToFloat64(v2)
		}

		s1 := cast.ToString(v1)
		s2 := cast.ToString(v2)

		return s1 < s2
	}

	pages, _ := spc.get(key, pageBy(paramsKeyComparator).Sort, p)

	return pages
}
1002980
func (confSrc *EnvConfigurationSource) GetConfigurationByKey(key string) (interface{}, error) {
	confSrc.Lock()
	defer confSrc.Unlock()
	value, ok := confSrc.Configurations[key]
	if !ok {
		return nil, errors.New("key does not exist")
	}

	return value, nil
}
591626
func SortByDistance(sp KeySpace, center Key, toSort []Key) []Key {
	toSortCopy := make([]Key, len(toSort))
	copy(toSortCopy, toSort)
	bdtc := &byDistanceToCenter{
		Center: center,
		Keys:   toSortCopy, // copy
	}
	sort.Sort(bdtc)
	return bdtc.Keys
}
1328755
func (b *Builder) HasKey(key string) (bool, error) {
	if b.stack.IsEmpty() {
		return false, WithStack(BuilderNeedOpenObjectError)
	}
	tos, _ := b.stack.Tos()
	h := b.buf[tos]
	if h != 0x0b && h != 0x14 {
		return false, WithStack(BuilderNeedOpenObjectError)
	}
	index := b.index[b.stack.Len()-1]
	if index.IsEmpty() {
		return false, nil
	}
	for _, idx := range index {
		s := Slice(b.buf[tos+idx:])
		k, err := s.makeKey()
		if err != nil {
			return false, WithStack(err)
		}
		if eq, err := k.IsEqualString(key); err != nil {
			return false, WithStack(err)
		} else if eq {
			return true, nil
		}
	}
	return false, nil
}
297557
func (d *Dataset) ReduceByKey(name string, reducerId gio.ReducerId) (ret *Dataset) {
	sortOption := Field(1)
	return d.ReduceBy(name, reducerId, sortOption)
}
294716
func (c *threadSafeMap) ByIndex(indexName, indexKey string) ([]interface{}, error) {
	c.lock.RLock()
	defer c.lock.RUnlock()

	indexFunc := c.indexers[indexName]
	if indexFunc == nil {
		return nil, fmt.Errorf("Index with name %s does not exist", indexName)
	}

	index := c.indices[indexName]

	set := index[indexKey]
	list := make([]interface{}, 0, set.Len())
	for _, key := range set.List() {
		list = append(list, c.items[key])
	}

	return list, nil
}
645267
func (eq Eq) sortedKeys() []string {
	keys := make([]string, 0, len(eq))
	for key := range eq {
		keys = append(keys, key)
	}
	sort.Strings(keys)
	return keys
}
519945
func (c *cache) GetByKey(key string) (item interface{}, exists bool, err error) {
	item, exists = c.cacheStorage.Get(key)
	return item, exists, nil
}
737620
func (m Menu) ByName() Menu {
	title := func(m1, m2 *MenuEntry) bool {
		return m1.Name < m2.Name
	}

	menuEntryBy(title).Sort(m)
	return m
}
1190928
func SortedKeys(m interface{}, t reflect.Type) interface{} {
	v := reflect.ValueOf(m)
	if v.Kind() != reflect.Map {
		panic("wrong type")
	}

	s := reflect.MakeSlice(reflect.SliceOf(v.Type().Key()), v.Len(), v.Len())
	for i, k := range v.MapKeys() {
		s.Index(i).Set(k)
	}

	s = s.Convert(t)
	sort.Sort(s.Interface().(sort.Interface))

	return s.Interface()
}
647780
func (builder *UpdateHllCommandBuilder) WithKey(key string) *UpdateHllCommandBuilder {
	builder.protobuf.Key = []byte(key)
	return builder
}