MCPcopy
hub / github.com/perkeep/perkeep / MarshalJSON

Method MarshalJSON

pkg/blob/ref.go:764–775  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

762}
763
764func (r Ref) MarshalJSON() ([]byte, error) {
765 if !r.Valid() {
766 return null, nil
767 }
768 dname := r.digest.digestName()
769 bs := r.digest.bytes()
770 buf := make([]byte, 0, 3+len(dname)+len(bs)*2)
771 buf = append(buf, '"')
772 buf = r.appendString(buf)
773 buf = append(buf, '"')
774 return buf, nil
775}
776
777// MarshalBinary implements Go's encoding.BinaryMarshaler interface.
778func (r Ref) MarshalBinary() (data []byte, err error) {

Callers

nothing calls this directly

Calls 4

ValidMethod · 0.95
appendStringMethod · 0.95
digestNameMethod · 0.65
bytesMethod · 0.65

Tested by

no test coverage detected