MCPcopy
hub / github.com/tinylib/msgp / Locate

Function Locate

msgp/edit.go:11–14  ·  view source on GitHub ↗

Locate returns a []byte pointing to the field in a messagepack map with the provided key. (The returned []byte points to a sub-slice of 'raw'; Locate does no allocations.) If the key doesn't exist in the map, a zero-length []byte will be returned.

(key string, raw []byte)

Source from the content-addressed store, hash-verified

9// points to a sub-slice of 'raw'; Locate does no allocations.) If the
10// key doesn't exist in the map, a zero-length []byte will be returned.
11func Locate(key string, raw []byte) []byte {
12 s, n := locate(raw, key)
13 return raw[s:n]
14}
15
16// Replace takes a key ("key") in a messagepack map ("raw")
17// and replaces its value with the one provided and returns

Callers 3

TestLocateFunction · 0.85
TestReplaceFunction · 0.85
BenchmarkLocateFunction · 0.85

Calls 1

locateFunction · 0.85

Tested by 3

TestLocateFunction · 0.68
TestReplaceFunction · 0.68
BenchmarkLocateFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…