MCPcopy Create free account
hub / github.com/encoder-run/operator / referenceToMap

Function referenceToMap

pkg/cache/redis/reference.go:230–244  ·  view source on GitHub ↗
(ref *plumbing.Reference)

Source from the content-addressed store, hash-verified

228func (iter *ReferenceIter) Close() {}
229
230func referenceToMap(ref *plumbing.Reference) (map[string]interface{}, error) {
231 if ref == nil {
232 return nil, fmt.Errorf("nil reference")
233 }
234 refMap := map[string]interface{}{
235 "Name": ref.Name().String(),
236 "Type": ref.Type().String(),
237 "Target": ref.Target().String(),
238 // Include other fields as necessary.
239 }
240 if ref.Type() == plumbing.HashReference {
241 refMap["Hash"] = ref.Hash().String()
242 }
243 return refMap, nil
244}
245
246func jsonToReference(data []byte) (*plumbing.Reference, error) {
247 var refMap map[string]interface{}

Callers 2

SetReferenceMethod · 0.85
CheckAndSetReferenceMethod · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected