Home / Function/ Benchmark_JSON_Binding_Bind() — fiber Function Reference

Benchmark_JSON_Binding_Bind() — fiber Function Reference

Architecture documentation for the Benchmark_JSON_Binding_Bind() function in json_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  8abcf918_99d6_0e3d_fcee_dc378f623ae4["Benchmark_JSON_Binding_Bind()"]
  b5c7d338_90e1_2834_abc9_49dc09418b2f["json_test.go"]
  8abcf918_99d6_0e3d_fcee_dc378f623ae4 -->|defined in| b5c7d338_90e1_2834_abc9_49dc09418b2f
  style 8abcf918_99d6_0e3d_fcee_dc378f623ae4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binder/json_test.go lines 42–68

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

	binder := &JSONBinding{
		JSONDecoder: json.Unmarshal,
	}

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

	var user User
	var err error
	for b.Loop() {
		err = binder.Bind([]byte(`{"name":"john","age":42,"posts":["post1","post2","post3"]}`), &user)
	}

	require.NoError(b, err)
	require.Equal(b, "john", user.Name)
	require.Equal(b, 42, user.Age)
	require.Len(b, user.Posts, 3)
	require.Equal(b, "post1", user.Posts[0])
	require.Equal(b, "post2", user.Posts[1])
	require.Equal(b, "post3", user.Posts[2])
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Benchmark_JSON_Binding_Bind() do?
Benchmark_JSON_Binding_Bind() is a function in the fiber codebase, defined in binder/json_test.go.
Where is Benchmark_JSON_Binding_Bind() defined?
Benchmark_JSON_Binding_Bind() is defined in binder/json_test.go at line 42.

Analyze Your Own Codebase

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

Try Supermodel Free