safemapstr

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 2 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Put

func Put(data mapstr.M, key string, value interface{}) error

Put This method implements a way to put dotted keys into a M while ensuring they don't override each other. For example:

a := M{}
safemapstr.Put(a, "com.docker.swarm.task", "x")
safemapstr.Put(a, "com.docker.swarm.task.id", 1)
safemapstr.Put(a, "com.docker.swarm.task.name", "foobar")

Will result in `{"com":{"docker":{"swarm":{"task":{"id":1,"name":"foobar","value":"x"}}}}}`

Put detects this scenario and renames the common base key, by appending `.value`

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL