Home / Function/ Test_URIBinding_Bind() — fiber Function Reference

Test_URIBinding_Bind() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

binder/uri_test.go lines 9–41

func Test_URIBinding_Bind(t *testing.T) {
	t.Parallel()

	b := &URIBinding{}
	require.Equal(t, "uri", b.Name())

	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 ""
	}

	err := b.Bind(paramsKey, paramsFunc, &user)
	require.NoError(t, err)
	require.Equal(t, "john", user.Name)
	require.Equal(t, 42, user.Age)
	require.Equal(t, []string{"post1,post2,post3"}, user.Posts)

	b.Reset()
}

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free