// Descending specifies the ordering of the results.
772550
func (q *SearchSortField) Descending(descending bool) *SearchSortField {
	q.options["desc"] = descending
	return q
}
98190
func (t *LLRB) DescendLessOrEqual(pivot Item, iterator ItemIterator) {
	t.descendLessOrEqual(t.root, pivot, iterator)
}
426362
func (l *Line) Reverse() *Line {
	l.a, l.b = l.b, l.a
	return l
}
477125
func DownSync(url, migrationsPath string) (err []error, ok bool) {
	pipe := pipep.New()
	go Down(pipe, url, migrationsPath)
	err = pipep.ReadErrors(pipe)
	return err, len(err) == 0
}
675085
func (p PendingEvaluations) Less(i, j int) bool {
	if p[i].JobID != p[j].JobID && p[i].Priority != p[j].Priority {
		return !(p[i].Priority < p[j].Priority)
	}
	return p[i].CreateIndex < p[j].CreateIndex
}
101631
func (s GeoDistanceSort) Order(ascending bool) GeoDistanceSort {
	s.ascending = ascending
	return s
}
311222
func (rr *roundRobin) down(addr Address, err error) {
	rr.mu.Lock()
	defer rr.mu.Unlock()
	for _, a := range rr.addrs {
		if addr == a.addr {
			a.connected = false
			break
		}
	}
}
811808
func (r *SearchRequest) Sort(field string, ascending bool) *SearchRequest {
	r.searchSource = r.searchSource.Sort(field, ascending)
	return r
}
1146284
func (s *ScrollService) Sort(field string, ascending bool) *ScrollService {
	s.ss = s.ss.Sort(field, ascending)
	return s
}
443037
func (v *vserver) downAll() {
	for _, s := range v.services {
		if v.active[s.ip] {
			v.down(s.ip)
		}
		if s.active {
			s.down()
		}
	}
}
221624
func (s *sorter) Less(i, j int) bool {
	return s.coordinates[i].Node < s.coordinates[j].Node
}
676964
func (p *Proxy) Down(maxfails uint32) bool {
	if maxfails == 0 {
		return false
	}

	fails := atomic.LoadUint32(&p.fails)
	return fails > maxfails
}
1121040
func (s ByEmergencyShutdown) Less(i, j int) bool {
	if s.CancellableServices[i].EmergencyShutdownLevel == s.CancellableServices[j].EmergencyShutdownLevel {
		// If emergency shutdown level is the same, order by reverse start level
		return s.CancellableServices[i].StartLevel-1 > s.CancellableServices[j].StartLevel-1
	} else {
		return s.CancellableServices[i].EmergencyShutdownLevel-1 < s.CancellableServices[j].EmergencyShutdownLevel-1
	}
}
234653
func lowerFirst(s string) string {
	if s == "" {
		return ""
	}

	str := ""
	strlen := len(s)

	/**
	  Loop each char
	  If is uppercase:
	    If is first char, LOWER it
	    If the following char is lower, LEAVE it
	    If the following char is upper OR numeric, LOWER it
	    If is the end of string, LEAVE it
	  Else lowercase
	*/

	foundLower := false
	for i := range s {
		ch := s[i]
		if isUpper(ch) {
			switch {
			case i == 0:
				str += string(ch + 32)
			case !foundLower: // Currently just a stream of capitals, eg JSONRESTS[erver]
				if strlen > (i+1) && isLower(s[i+1]) {
					// Next char is lower, keep this a capital
					str += string(ch)
				} else {
					// Either at end of string or next char is capital
					str += string(ch + 32)
				}
			default:
				str += string(ch)
			}
		} else {
			foundLower = true
			str += string(ch)
		}
	}

	return str
}
1328143
func (s *ListJobsByPipelineInput) SetAscending(v string) *ListJobsByPipelineInput {
	s.Ascending = &v
	return s
}
211565
func (t *BTree) DescendGreaterThan(pivot Item, iterator ItemIterator) {
	if t.root == nil {
		return
	}
	t.root.iterate(descend, nil, pivot, false, false, iterator)
}
782516
func (s *ListPipelinesInput) SetAscending(v string) *ListPipelinesInput {
	s.Ascending = &v
	return s
}