Home / File/ tree.go — gin Source File

tree.go — gin Source File

Architecture documentation for tree.go, a go file in the gin codebase. 1 imports, 0 dependents.

File go GinCore Routing 1 imports 5 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  c26db86d_6014_ffb1_aad9_2c5f3b61998b["tree.go"]
  dd22f157_5213_a01e_8cac_57f536e4ef80["url"]
  c26db86d_6014_ffb1_aad9_2c5f3b61998b --> dd22f157_5213_a01e_8cac_57f536e4ef80
  style c26db86d_6014_ffb1_aad9_2c5f3b61998b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2013 Julien Schmidt. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// at https://github.com/julienschmidt/httprouter/blob/master/LICENSE

package gin

import (
	"net/url"
	"strings"
	"unicode"
	"unicode/utf8"

	"github.com/gin-gonic/gin/internal/bytesconv"
)

// Param is a single URL parameter, consisting of a key and a value.
type Param struct {
	Key   string
	Value string
}

// Params is a Param-slice, as returned by the router.
// The slice is ordered, the first URL parameter is also the first slice value.
// It is therefore safe to read values by the index.
type Params []Param

// Get returns the value of the first Param which key matches the given name and a boolean true.
// If no matching Param is found, an empty string is returned and a boolean false .
func (ps Params) Get(name string) (string, bool) {
	for _, entry := range ps {
		if entry.Key == name {
			return entry.Value, true
		}
	}
	return "", false
}

// ByName returns the value of the first Param which key matches the given name.
// If no matching Param is found, an empty string is returned.
func (ps Params) ByName(name string) (va string) {
	va, _ = ps.Get(name)
	return
}

type methodTree struct {
	method string
	root   *node
}

type methodTrees []methodTree

func (trees methodTrees) get(method string) *node {
	for _, tree := range trees {
		if tree.method == method {
			return tree.root
		}
	}
	return nil
}

// ... (826 more lines)

Domain

Subdomains

Dependencies

  • url

Frequently Asked Questions

What does tree.go do?
tree.go is a source file in the gin codebase, written in go. It belongs to the GinCore domain, Routing subdomain.
What functions are defined in tree.go?
tree.go defines 5 function(s): countParams, countSections, findWildcard, longestCommonPrefix, shiftNRuneBytes.
What does tree.go depend on?
tree.go imports 1 module(s): url.
Where is tree.go in the architecture?
tree.go is located at tree.go (domain: GinCore, subdomain: Routing).

Analyze Your Own Codebase

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

Try Supermodel Free