Home / Function/ exampleFromPath() — gin Function Reference

exampleFromPath() — gin Function Reference

Architecture documentation for the exampleFromPath() function in githubapi_test.go from the gin codebase.

Function go GinCore Routing called by 4

Entity Profile

Dependency Diagram

graph TD
  3a892a12_f532_bb8c_bb71_193635cb2f99["exampleFromPath()"]
  851931d7_59a3_9c02_f8d4_6771ae5af6e6["githubapi_test.go"]
  3a892a12_f532_bb8c_bb71_193635cb2f99 -->|defined in| 851931d7_59a3_9c02_f8d4_6771ae5af6e6
  50715375_fa3d_e53c_71a9_afcaee6f4762["TestShouldBindUri()"]
  50715375_fa3d_e53c_71a9_afcaee6f4762 -->|calls| 3a892a12_f532_bb8c_bb71_193635cb2f99
  5f537ee5_114b_3037_7a87_16368102da0f["TestBindUri()"]
  5f537ee5_114b_3037_7a87_16368102da0f -->|calls| 3a892a12_f532_bb8c_bb71_193635cb2f99
  cbcacda3_8dce_9cde_d6c4_c5c12a19fdea["TestBindUriError()"]
  cbcacda3_8dce_9cde_d6c4_c5c12a19fdea -->|calls| 3a892a12_f532_bb8c_bb71_193635cb2f99
  cf0ceb9e_7c84_7ee1_cfb9_5fecff9574b3["TestGithubAPI()"]
  cf0ceb9e_7c84_7ee1_cfb9_5fecff9574b3 -->|calls| 3a892a12_f532_bb8c_bb71_193635cb2f99
  style 3a892a12_f532_bb8c_bb71_193635cb2f99 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

githubapi_test.go lines 405–438

func exampleFromPath(path string) (string, Params) {
	output := new(strings.Builder)
	params := make(Params, 0, 6)
	start := -1
	for i, c := range path {
		if c == ':' {
			start = i + 1
		}
		if start >= 0 {
			if c == '/' {
				value := strconv.Itoa(rand.Intn(100000))
				params = append(params, Param{
					Key:   path[start:i],
					Value: value,
				})
				output.WriteString(value)
				output.WriteRune(c)
				start = -1
			}
		} else {
			output.WriteRune(c)
		}
	}
	if start >= 0 {
		value := strconv.Itoa(rand.Intn(100000))
		params = append(params, Param{
			Key:   path[start:],
			Value: value,
		})
		output.WriteString(value)
	}

	return output.String(), params
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does exampleFromPath() do?
exampleFromPath() is a function in the gin codebase, defined in githubapi_test.go.
Where is exampleFromPath() defined?
exampleFromPath() is defined in githubapi_test.go at line 405.
What calls exampleFromPath()?
exampleFromPath() is called by 4 function(s): TestBindUri, TestBindUriError, TestGithubAPI, TestShouldBindUri.

Analyze Your Own Codebase

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

Try Supermodel Free