From 4ee8db7649f0d6ed187c52d134d99c7ac1b7c0a5 Mon Sep 17 00:00:00 2001 From: luasenvy Date: Fri, 29 Dec 2023 13:12:16 +0900 Subject: [PATCH] support timeseries array labels --- packages/time-series/lib/commands/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/time-series/lib/commands/index.ts b/packages/time-series/lib/commands/index.ts index 356b0416648..38f987bb247 100644 --- a/packages/time-series/lib/commands/index.ts +++ b/packages/time-series/lib/commands/index.ts @@ -179,7 +179,7 @@ export function pushDuplicatePolicy(args: RedisCommandArguments, duplicatePolicy export type RawLabels = Array<[label: string, value: string]>; export type Labels = { - [label: string]: string; + [label: string]: string | Array; }; export function transformLablesReply(reply: RawLabels): Labels { @@ -197,7 +197,13 @@ export function pushLabelsArgument(args: RedisCommandArguments, labels?: Labels) args.push('LABELS'); for (const [label, value] of Object.entries(labels)) { - args.push(label, value); + if (Array.isArray(value)) { + for (const item of value) { + args.push(label, item); + } + } else { + args.push(label, value); + } } }