MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / EncodeStringMap

Function EncodeStringMap

pkg/util/utilfn/utilfn.go:396–408  ·  view source on GitHub ↗
(m map[string]string)

Source from the content-addressed store, hash-verified

394)
395
396func EncodeStringMap(m map[string]string) []byte {
397 var buf bytes.Buffer
398 for idx, key := range GetOrderedMapKeys(m) {
399 val := m[key]
400 buf.Write(NullEncodeStr(key))
401 buf.WriteByte(nullEncodeEqByte)
402 buf.Write(NullEncodeStr(val))
403 if idx < len(m)-1 {
404 buf.WriteByte(nullEncodeSepByte)
405 }
406 }
407 return buf.Bytes()
408}
409
410func DecodeStringMap(barr []byte) (map[string]string, error) {
411 if len(barr) == 0 {

Callers

nothing calls this directly

Calls 4

GetOrderedMapKeysFunction · 0.85
NullEncodeStrFunction · 0.85
BytesMethod · 0.80
WriteMethod · 0.65

Tested by

no test coverage detected