MCPcopy Index your code
hub / github.com/HDT3213/rdb / writeHashEncoding

Method writeHashEncoding

core/hash.go:355–379  ·  view source on GitHub ↗
(key string, hash map[string][]byte, options ...interface{})

Source from the content-addressed store, hash-verified

353}
354
355func (enc *Encoder) writeHashEncoding(key string, hash map[string][]byte, options ...interface{}) error {
356 err := enc.write([]byte{typeHash})
357 if err != nil {
358 return err
359 }
360 err = enc.writeString(key)
361 if err != nil {
362 return err
363 }
364 err = enc.writeLength(uint64(len(hash)))
365 if err != nil {
366 return err
367 }
368 for field, value := range hash {
369 err = enc.writeString(field)
370 if err != nil {
371 return err
372 }
373 err = enc.writeString(unsafeBytes2Str(value))
374 if err != nil {
375 return err
376 }
377 }
378 return nil
379}
380
381func (enc *Encoder) writeHashEncodingEx(key string, hash map[string][]byte, expire map[string]int64, options ...interface{}) error {
382 err := enc.write([]byte{typeHashWithHfe})

Callers 1

WriteHashMapObjectMethod · 0.95

Calls 4

writeMethod · 0.95
writeStringMethod · 0.95
writeLengthMethod · 0.95
unsafeBytes2StrFunction · 0.70

Tested by

no test coverage detected