| 2098 | }; |
| 2099 | |
| 2100 | static 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 | |
| 2125 | static const char *json_prefix(const tal_t *ctx, |
| 2126 | const struct table_desc *td) |
no test coverage detected