Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support timeseries multiple labels with same key #2677

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/time-series/lib/commands/index.ts
Expand Up @@ -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<string>;
};

export function transformLablesReply(reply: RawLabels): Labels {
Expand All @@ -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);
}
}
}

Expand Down