๐ฆ ๐พ The Redis Streams API will land in deno-redis pretty soon. Iโm nearing completion with this pull request and hope for a thorough review.
๐ ๐ Thereโs been a lot of activity in this repository, which is encouraging!
We gladly welcome feedback on the design. You can read the method defs in command.ts
to see the most up-to-date version of the command inputs & outputs
The effort is nearing completion as a pre-review draft. Thanks for your patience.
We implemented strong types for stream entry IDs:
export interface XId {
unixMs: bigint;
seqNo: bigint;
}
Because Redis returns 64bit ints in these values, we use bigint
.
We made an effort to ensure flexibility in the command interfaces. For instance, in xadd
, you may also pass simple numbers, or paired numbers [1000,10]
, or the special string "*"
.
Methods which return XId
s will always return the exact form, so that you can deconstruct them with minimal pain.
See XId
and the related types in streams.ts
for details.
We offer an interface
for the XREAD reply type which is hopefully less annoying to use than the Redis default array type. Please note that we return field_value pairs as a Map
.
export interface XMessage {
id: XId;
field_values: Map<string, string>;
}
export type XReadStream = { key: string; messages: XMessage[] };
export type XReadReply = XReadStream[];
#deno #redis #api #node #developer