Home / Function/ incrementChildPrio() — gin Function Reference

incrementChildPrio() — gin Function Reference

Architecture documentation for the incrementChildPrio() function in tree.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  56fd4895_ab64_982a_9ad0_06c8140ee252["incrementChildPrio()"]
  1e254bd3_e110_d850_2675_5cdfb2b748aa["addRoute()"]
  1e254bd3_e110_d850_2675_5cdfb2b748aa -->|calls| 56fd4895_ab64_982a_9ad0_06c8140ee252
  style 56fd4895_ab64_982a_9ad0_06c8140ee252 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tree.go lines 111–131

func (n *node) incrementChildPrio(pos int) int {
	cs := n.children
	cs[pos].priority++
	prio := cs[pos].priority

	// Adjust position (move to front)
	newPos := pos
	for ; newPos > 0 && cs[newPos-1].priority < prio; newPos-- {
		// Swap node positions
		cs[newPos-1], cs[newPos] = cs[newPos], cs[newPos-1]
	}

	// Build new index char string
	if newPos != pos {
		n.indices = n.indices[:newPos] + // Unchanged prefix, might be empty
			n.indices[pos:pos+1] + // The index char we move
			n.indices[newPos:pos] + n.indices[pos+1:] // Rest without char at 'pos'
	}

	return newPos
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does incrementChildPrio() do?
incrementChildPrio() is a function in the gin codebase.
What calls incrementChildPrio()?
incrementChildPrio() is called by 1 function(s): addRoute.

Analyze Your Own Codebase

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

Try Supermodel Free