MCPcopy
hub / github.com/dosco/graphjin / processObject

Method processObject

core/cache_response.go:310–348  ·  view source on GitHub ↗
(
	tableName string,
	obj map[string]interface{},
	refs *[]RowRef,
	sel *qcode.Select,
)

Source from the content-addressed store, hash-verified

308}
309
310func (rp *ResponseProcessor) processObject(
311 tableName string,
312 obj map[string]interface{},
313 refs *[]RowRef,
314 sel *qcode.Select,
315) {
316 // Extract and remove __gj_id
317 if id, ok := obj["__gj_id"]; ok {
318 *refs = append(*refs, RowRef{
319 Table: tableName,
320 ID: stringifyID(id),
321 })
322 delete(obj, "__gj_id")
323 } else if id, ok := primaryKeyValueFromObject(obj, sel); ok {
324 *refs = append(*refs, RowRef{
325 Table: tableName,
326 ID: stringifyID(id),
327 })
328 }
329
330 // Process child selections
331 if sel != nil {
332 for _, childID := range sel.Children {
333 if childID < 0 || int(childID) >= len(rp.qc.Selects) {
334 continue
335 }
336 childSel := &rp.qc.Selects[childID]
337
338 fieldName := childSel.FieldName
339 if fieldName == "" {
340 fieldName = childSel.Table
341 }
342
343 if childData, ok := obj[fieldName]; ok {
344 rp.processNode(childSel.Table, childData, refs, childSel)
345 }
346 }
347 }
348}
349
350func responseDataMap(result map[string]interface{}) (map[string]interface{}, bool) {
351 if dataField, ok := result["data"]; ok {

Callers 1

processNodeMethod · 0.95

Calls 4

processNodeMethod · 0.95
stringifyIDFunction · 0.85
deleteFunction · 0.50

Tested by

no test coverage detected