MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / NestedMap

Method NestedMap

options/options.go:331–352  ·  view source on GitHub ↗

NestedMap returns Options as a nested map[string]any. Each key is split by dots (.) and the resulting keys are used to create a nested structure. If the Options has a child, it puts the main and child maps under "0", "1", "2", etc. keys representing the options depth (e.g., "0" for main options, "1"

()

Source from the content-addressed store, hash-verified

329// representing the options depth
330// (e.g., "0" for main options, "1" for child options, "2" for grandchild options, etc.)
331func (o *Options) NestedMap() map[string]any {
332 if o.child == nil {
333 return o.nestedMap()
334 }
335
336 totalMaps := 1
337 for child := o.child; child != nil; child = child.child {
338 totalMaps++
339 }
340
341 result := make(map[string]any, totalMaps)
342
343 result["0"] = o.nestedMap()
344
345 depth := 1
346 for c := range o.Descendants() {
347 result[strconv.Itoa(depth)] = c.nestedMap()
348 depth++
349 }
350
351 return result
352}
353
354// String returns Options as a string representation of the map.
355func (o *Options) String() string {

Callers 5

MarshalJSONMethod · 0.95
LogValueMethod · 0.95
TestNestedMapMethod · 0.80
BenchmarkNestedMapFunction · 0.80
newRequestMethod · 0.80

Calls 2

nestedMapMethod · 0.95
DescendantsMethod · 0.95

Tested by 2

TestNestedMapMethod · 0.64
BenchmarkNestedMapFunction · 0.64