Home / Function/ sortAcceptedTypes() — fiber Function Reference

sortAcceptedTypes() — fiber Function Reference

Architecture documentation for the sortAcceptedTypes() function in helpers.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  9c05c3f3_14ea_d339_1411_336245d4b7f1["sortAcceptedTypes()"]
  bec0e401_e4cd_f765_6df3_a79059073e50["helpers.go"]
  9c05c3f3_14ea_d339_1411_336245d4b7f1 -->|defined in| bec0e401_e4cd_f765_6df3_a79059073e50
  e3cc6318_07a4_ecac_7c64_699264bff354["getOffer()"]
  e3cc6318_07a4_ecac_7c64_699264bff354 -->|calls| 9c05c3f3_14ea_d339_1411_336245d4b7f1
  style 9c05c3f3_14ea_d339_1411_336245d4b7f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

helpers.go lines 642–660

func sortAcceptedTypes(at []acceptedType) {
	for i := 1; i < len(at); i++ {
		lo, hi := 0, i-1
		for lo <= hi {
			mid := (lo + hi) / 2
			if at[i].quality < at[mid].quality ||
				(at[i].quality == at[mid].quality && at[i].specificity < at[mid].specificity) ||
				(at[i].quality == at[mid].quality && at[i].specificity == at[mid].specificity && len(at[i].params) < len(at[mid].params)) ||
				(at[i].quality == at[mid].quality && at[i].specificity == at[mid].specificity && len(at[i].params) == len(at[mid].params) && at[i].order > at[mid].order) {
				lo = mid + 1
			} else {
				hi = mid - 1
			}
		}
		for j := i; j > lo; j-- {
			at[j-1], at[j] = at[j], at[j-1]
		}
	}
}

Domain

Subdomains

Defined In

Called By

Frequently Asked Questions

What does sortAcceptedTypes() do?
sortAcceptedTypes() is a function in the fiber codebase, defined in helpers.go.
Where is sortAcceptedTypes() defined?
sortAcceptedTypes() is defined in helpers.go at line 642.
What calls sortAcceptedTypes()?
sortAcceptedTypes() is called by 1 function(s): getOffer.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free