(
tableName string,
obj map[string]interface{},
refs *[]RowRef,
sel *qcode.Select,
)
| 308 | } |
| 309 | |
| 310 | func (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 | |
| 350 | func responseDataMap(result map[string]interface{}) (map[string]interface{}, bool) { |
| 351 | if dataField, ok := result["data"]; ok { |
no test coverage detected