Home / Function/ parseParamSquareBrackets() — fiber Function Reference

parseParamSquareBrackets() — fiber Function Reference

Architecture documentation for the parseParamSquareBrackets() function in mapping.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  541010f8_f5a6_0411_daa3_c8daf21f77ef["parseParamSquareBrackets()"]
  5a1aea01_8a49_a350_626b_5da5e78187fd["mapping.go"]
  541010f8_f5a6_0411_daa3_c8daf21f77ef -->|defined in| 5a1aea01_8a49_a350_626b_5da5e78187fd
  0c499e04_d3db_214b_442d_951de615b189["formatBindData()"]
  0c499e04_d3db_214b_442d_951de615b189 -->|calls| 541010f8_f5a6_0411_daa3_c8daf21f77ef
  style 541010f8_f5a6_0411_daa3_c8daf21f77ef fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binder/mapping.go lines 180–216

func parseParamSquareBrackets(k string) (string, error) {
	bb := bytebufferpool.Get()
	defer bytebufferpool.Put(bb)

	kbytes := []byte(k)
	openBracketsCount := 0

	for i, b := range kbytes {
		if b == '[' {
			openBracketsCount++
			if i+1 < len(kbytes) && kbytes[i+1] != ']' {
				if err := bb.WriteByte('.'); err != nil {
					return "", err //nolint:wrapcheck // unnecessary to wrap it
				}
			}
			continue
		}

		if b == ']' {
			openBracketsCount--
			if openBracketsCount < 0 {
				return "", ErrUnmatchedBrackets
			}
			continue
		}

		if err := bb.WriteByte(b); err != nil {
			return "", err //nolint:wrapcheck // unnecessary to wrap it
		}
	}

	if openBracketsCount > 0 {
		return "", ErrUnmatchedBrackets
	}

	return bb.String(), nil
}

Domain

Subdomains

Defined In

Called By

Frequently Asked Questions

What does parseParamSquareBrackets() do?
parseParamSquareBrackets() is a function in the fiber codebase, defined in binder/mapping.go.
Where is parseParamSquareBrackets() defined?
parseParamSquareBrackets() is defined in binder/mapping.go at line 180.
What calls parseParamSquareBrackets()?
parseParamSquareBrackets() is called by 1 function(s): formatBindData.

Analyze Your Own Codebase

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

Try Supermodel Free