beats: github.com/elastic/beats/libbeat/common/safemapstr Index | Files

package safemapstr

import "github.com/elastic/beats/libbeat/common/safemapstr"

Index

Package Files

safemapstr.go

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, "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`

Package safemapstr imports 2 packages (graph) and is imported by 85 packages. Updated 2018-12-10. Refresh now. Tools for package owners.