From 199bb75dea94b7606049b9676a044c198dd03dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Olguncu?= <21091016+ogzhanolguncu@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:20:35 +0300 Subject: [PATCH] Stream commands (#636) * feat: xadd * Add xrange and xrange test * fix: nested decoding * Add tests for xrange * Add tests for xadd * Remove dependabot * Add missing imports to entry file * Format redis.ts --------- Co-authored-by: chronark --- pkg/commands/mod.ts | 3 ++- pkg/redis.ts | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pkg/commands/mod.ts b/pkg/commands/mod.ts index 8ca08e97..2613da59 100644 --- a/pkg/commands/mod.ts +++ b/pkg/commands/mod.ts @@ -120,7 +120,6 @@ export * from "./touch.ts"; export * from "./ttl.ts"; export * from "./type.ts"; export * from "./unlink.ts"; -export * from "./xadd.ts"; export * from "./zadd.ts"; export * from "./zcard.ts"; export * from "./zcount.ts"; @@ -139,3 +138,5 @@ export * from "./zrevrank.ts"; export * from "./zscan.ts"; export * from "./zscore.ts"; export * from "./zunionstore.ts"; +export * from "./xadd.ts"; +export * from "./xrange.ts"; diff --git a/pkg/redis.ts b/pkg/redis.ts index 88f3d719..c045f342 100644 --- a/pkg/redis.ts +++ b/pkg/redis.ts @@ -124,6 +124,7 @@ import { TypeCommand, UnlinkCommand, XAddCommand, + XRangeCommand, ZAddCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, @@ -407,7 +408,9 @@ export class Redis { new BitOpCommand( [op as any, destinationKey, sourceKey, ...sourceKeys], this.opts, - ).exec(this.client); + ).exec( + this.client, + ); /** * @see https://redis.io/commands/bitpos @@ -1015,10 +1018,17 @@ export class Redis { unlink = (...args: CommandArgs) => new UnlinkCommand(args, this.opts).exec(this.client); - // /** - // * @see https://redis.io/commands/xadd - // */ - // xadd = + /** + * @see https://redis.io/commands/xadd + */ + xadd = (...args: CommandArgs) => + new XAddCommand(args, this.opts).exec(this.client); + + /** + * @see https://redis.io/commands/xrange + */ + xrange = (...args: CommandArgs) => + new XRangeCommand(args, this.opts).exec(this.client); /** * @see https://redis.io/commands/zadd