beats: Index | Files

package safemapstr

import ""


Package Files


func Put Uses

func Put(data common.MapStr, key string, value interface{}) error

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

a := MapStr{}
safemapstr.Put(a, "com.docker.swarm.task", "x")
safemapstr.Put(a, "", 1)
safemapstr.Put(a, "", "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`

Package safemapstr imports 2 packages (graph) and is imported by 171 packages. Updated 2020-04-01. Refresh now. Tools for package owners.