-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
types.ts
50 lines (37 loc) 路 1.21 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { ErrorReplyError } from "../../errors.ts";
/**
* @see https://redis.io/topics/protocol
*/
export type RedisValue = string | number | Uint8Array;
/**
* @description Represents the type of the value returned by `SimpleStringReply#value()`.
*/
export type SimpleString = string;
/**
* @description Represents the type of the value returned by `IntegerReply#value()`.
*/
export type Integer = number;
/**
* @description Represents the type of the value returned by `BulkReply#value()`.
*/
export type Bulk = BulkString | BulkNil;
/**
* @description Represents the **bulk string** type in the RESP2 protocol.
*/
export type BulkString = string;
/**
* @description Represents the **null bulk string** and **null array** in the RESP2 protocol.
*/
export type BulkNil = null;
/**
* @description Represents the some type in the RESP2 protocol.
*/
export type Raw = SimpleString | Integer | Bulk | ConditionalArray | Binary;
export type Binary = Uint8Array;
/**
* @description Represents the type of the value returned by `ArrayReply#value()`.
*/
export type ConditionalArray = Raw[];
export type RedisReply = Raw | ConditionalArray;
export type RawOrError = Raw | ErrorReplyError;
export const okReply = "OK";