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

Function fmt_indexes

plugins/sql.c:2100–2123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2098};
2099
2100static const char *fmt_indexes(const tal_t *ctx, const char *table)
2101{
2102 char *ret = NULL;
2103
2104 for (size_t i = 0; i < ARRAY_SIZE(indices); i++) {
2105 if (!streq(indices[i].tablename, table))
2106 continue;
2107 if (!ret)
2108 ret = tal_fmt(ctx, " indexed by ");
2109 else
2110 tal_append_fmt(&ret, ", also indexed by ");
2111 BUILD_ASSERT(ARRAY_SIZE(indices[i].fields) == 2);
2112 if (indices[i].fields[1])
2113 tal_append_fmt(&ret, "`%s` and `%s`",
2114 indices[i].fields[0],
2115 indices[i].fields[1]);
2116 else
2117 tal_append_fmt(&ret, "`%s`",
2118 indices[i].fields[0]);
2119 }
2120 if (!ret)
2121 return "";
2122 return ret;
2123}
2124
2125static const char *json_prefix(const tal_t *ctx,
2126 const struct table_desc *td)

Callers 1

print_one_tableFunction · 0.85

Calls 1

tal_append_fmtFunction · 0.85

Tested by

no test coverage detected