plugins/sql: fix doc formatting for tables with multiple indices.

Before vs after:

   - `forwards` indexed by `in_channel and in_htlc_id` (see lightning-listforwards(7))
   - `forwards` indexed by `in_channel` and `in_htlc_id` (see lightning-listforwards(7))

And:
   - `htlcs` indexed by `short_channel_id and id` (see lightning-listhtlcs(7))
   - `htlcs` indexed by `short_channel_id` and `id` (see lightning-listhtlcs(7))

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-07-08 16:14:43 +09:30
parent de5e4fe9ca
commit 89c4201918

View File

@@ -1581,16 +1581,16 @@ static const char *fmt_indexes(const tal_t *ctx, const char *table)
assert(!ret);
BUILD_ASSERT(ARRAY_SIZE(indices[i].fields) == 2);
if (indices[i].fields[1])
ret = tal_fmt(tmpctx, "%s and %s",
ret = tal_fmt(tmpctx, "`%s` and `%s`",
indices[i].fields[0],
indices[i].fields[1]);
else
ret = tal_fmt(tmpctx, "%s",
ret = tal_fmt(tmpctx, "`%s`",
indices[i].fields[0]);
}
if (!ret)
return "";
return tal_fmt(ctx, " indexed by `%s`", ret);
return tal_fmt(ctx, " indexed by %s", ret);
}
static const char *json_prefix(const tal_t *ctx,