Home / Function/ Benchmark_URIBinding_Bind() — fiber Function Reference

Benchmark_URIBinding_Bind() — fiber Function Reference

Architecture documentation for the Benchmark_URIBinding_Bind() function in uri_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  272b06fb_9a4e_7adf_2c65_738d72e3d31e["Benchmark_URIBinding_Bind()"]
  c4164218_4bf2_a68e_2e67_ca7764ab2575["uri_test.go"]
  272b06fb_9a4e_7adf_2c65_738d72e3d31e -->|defined in| c4164218_4bf2_a68e_2e67_ca7764ab2575
  style 272b06fb_9a4e_7adf_2c65_738d72e3d31e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binder/uri_test.go lines 43–76

func Benchmark_URIBinding_Bind(b *testing.B) {
	b.ReportAllocs()

	binder := &URIBinding{}

	type User struct {
		Name  string   `uri:"name"`
		Posts []string `uri:"posts"`
		Age   int      `uri:"age"`
	}
	var user User

	paramsKey := []string{"name", "age", "posts"}
	paramsVals := []string{"john", "42", "post1,post2,post3"}
	paramsFunc := func(key string, _ ...string) string {
		for i, k := range paramsKey {
			if k == key {
				return paramsVals[i]
			}
		}

		return ""
	}

	var err error
	for b.Loop() {
		err = binder.Bind(paramsKey, paramsFunc, &user)
	}

	require.NoError(b, err)
	require.Equal(b, "john", user.Name)
	require.Equal(b, 42, user.Age)
	require.Equal(b, []string{"post1,post2,post3"}, user.Posts)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Benchmark_URIBinding_Bind() do?
Benchmark_URIBinding_Bind() is a function in the fiber codebase, defined in binder/uri_test.go.
Where is Benchmark_URIBinding_Bind() defined?
Benchmark_URIBinding_Bind() is defined in binder/uri_test.go at line 43.

Analyze Your Own Codebase

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

Try Supermodel Free