MCPcopy Create free account
hub / github.com/ElementsProject/lightning / process_json_subobjs

Function process_json_subobjs

plugins/sql.c:633–666  ·  view source on GitHub ↗

Process all subobject columns */

Source from the content-addressed store, hash-verified

631
632/* Process all subobject columns */
633static struct command_result *process_json_subobjs(struct command *cmd,
634 const char *buf,
635 const jsmntok_t *t,
636 const struct table_desc *td,
637 u64 this_rowid,
638 u64 *last_created_index,
639 u64 *last_updated_index)
640{
641 for (size_t i = 0; i < tal_count(td->columns); i++) {
642 const struct column *col = td->columns[i];
643 struct command_result *ret;
644 const jsmntok_t *coltok;
645
646 if (!col->sub)
647 continue;
648
649 coltok = json_get_member(buf, t, col->jsonname);
650 if (!coltok)
651 continue;
652
653 /* If it's an array, use process_json_list */
654 if (!col->sub->is_subobject) {
655 ret = process_json_list(cmd, buf, coltok, &this_rowid,
656 col->sub, false,
657 last_created_index, last_updated_index);
658 } else {
659 ret = process_json_subobjs(cmd, buf, coltok, col->sub,
660 this_rowid, last_created_index, last_updated_index);
661 }
662 if (ret)
663 return ret;
664 }
665 return NULL;
666}
667
668/* Returns NULL on success, otherwise has failed cmd. */
669static struct command_result *process_json_obj(struct command *cmd,

Callers 1

process_json_objFunction · 0.85

Calls 2

json_get_memberFunction · 0.85
process_json_listFunction · 0.85

Tested by

no test coverage detected