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

Node - Add binary support to transaction commands #2187

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions node/src/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ import {
createXGroupCreateConsumer,
createXGroupDelConsumer,
createXGroupDestroy,
createXGroupSetid,
createXInfoConsumers,
createXInfoGroups,
createXInfoStream,
Expand Down Expand Up @@ -259,7 +260,6 @@ import {
createZScore,
createZUnion,
createZUnionStore,
createXGroupSetid,
} from "./Commands";
import { command_request } from "./ProtobufMessage";

Expand Down Expand Up @@ -371,7 +371,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
*
* Command Response - substring extracted from the value stored at `key`.
*/
public getrange(key: string, start: number, end: number): T {
public getrange(key: GlideString, start: number, end: number): T {
return this.addAndReturn(createGetRange(key, start, end));
}

Expand Down Expand Up @@ -498,7 +498,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - A list of values corresponding to the provided keys. If a key is not found,
* its corresponding value in the list will be null.
*/
public mget(keys: string[]): T {
public mget(keys: GlideString[]): T {
return this.addAndReturn(createMGet(keys));
}

Expand Down Expand Up @@ -778,7 +778,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
*
* Command Response - the value associated with `field`, or null when `field` is not present in the hash or `key` does not exist.
*/
public hget(key: string, field: string): T {
public hget(key: GlideString, field: GlideString): T {
return this.addAndReturn(createHGet(key, field));
}

Expand Down Expand Up @@ -924,7 +924,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
*
* Command Response - a list of values in the hash, or an empty list when the key does not exist.
*/
public hvals(key: string): T {
public hvals(key: GlideString): T {
return this.addAndReturn(createHVals(key));
}

Expand Down Expand Up @@ -1024,7 +1024,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
*
* Command Response - the length of the list after the push operations.
*/
public lpush(key: string, elements: string[]): T {
public lpush(key: GlideString, elements: GlideString[]): T {
return this.addAndReturn(createLPush(key, elements));
}

Expand Down Expand Up @@ -1052,7 +1052,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - The value of the first element.
* If `key` does not exist null will be returned.
*/
public lpop(key: string): T {
public lpop(key: GlideString): T {
return this.addAndReturn(createLPop(key));
}

Expand All @@ -1065,7 +1065,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - A list of the popped elements will be returned depending on the list's length.
* If `key` does not exist null will be returned.
*/
public lpopCount(key: string, count: number): T {
public lpopCount(key: GlideString, count: number): T {
return this.addAndReturn(createLPop(key, count));
}

Expand All @@ -1084,7 +1084,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* If `end` exceeds the actual end of the list, the range will stop at the actual end of the list.
* If `key` does not exist an empty list will be returned.
*/
public lrange(key: string, start: number, end: number): T {
public lrange(key: GlideString, start: number, end: number): T {
return this.addAndReturn(createLRange(key, start, end));
}

Expand All @@ -1096,7 +1096,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - the length of the list at `key`.
* If `key` does not exist, it is interpreted as an empty list and 0 is returned.
*/
public llen(key: string): T {
public llen(key: GlideString): T {
return this.addAndReturn(createLLen(key));
}

Expand All @@ -1116,8 +1116,8 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - The popped element, or `null` if `source` does not exist.
*/
public lmove(
source: string,
destination: string,
source: GlideString,
destination: GlideString,
whereFrom: ListDirection,
whereTo: ListDirection,
): T {
Expand Down Expand Up @@ -1147,8 +1147,8 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - The popped element, or `null` if `source` does not exist or if the operation timed-out.
*/
public blmove(
source: string,
destination: string,
source: GlideString,
destination: GlideString,
whereFrom: ListDirection,
whereTo: ListDirection,
timeout: number,
Expand Down Expand Up @@ -1221,7 +1221,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
*
* Command Response - the length of the list after the push operations.
*/
public rpush(key: string, elements: string[]): T {
public rpush(key: GlideString, elements: GlideString[]): T {
return this.addAndReturn(createRPush(key, elements));
}

Expand Down Expand Up @@ -1249,7 +1249,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - The value of the last element.
* If `key` does not exist null will be returned.
*/
public rpop(key: string): T {
public rpop(key: GlideString): T {
return this.addAndReturn(createRPop(key));
}

Expand All @@ -1262,7 +1262,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - A list of popped elements will be returned depending on the list's length.
* If `key` does not exist null will be returned.
*/
public rpopCount(key: string, count: number): T {
public rpopCount(key: GlideString, count: number): T {
return this.addAndReturn(createRPop(key, count));
}

Expand Down Expand Up @@ -2404,7 +2404,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - The element at index in the list stored at `key`.
* If `index` is out of range or if `key` does not exist, null is returned.
*/
public lindex(key: string, index: number): T {
public lindex(key: GlideString, index: number): T {
return this.addAndReturn(createLIndex(key, index));
}

Expand All @@ -2424,10 +2424,10 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* If the `pivot` wasn't found, returns `0`.
*/
public linsert(
key: string,
key: GlideString,
position: InsertPosition,
pivot: string,
element: string,
pivot: GlideString,
element: GlideString,
): T {
return this.addAndReturn(createLInsert(key, position, pivot, element));
}
Expand Down Expand Up @@ -2984,7 +2984,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - An `array` containing the `key` from which the element was popped and the value of the popped element,
* formatted as [key, value]. If no element could be popped and the timeout expired, returns `null`.
*/
public brpop(keys: string[], timeout: number): T {
public brpop(keys: GlideString[], timeout: number): T {
return this.addAndReturn(createBRPop(keys, timeout));
}

Expand All @@ -3002,7 +3002,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - An `array` containing the `key` from which the element was popped and the value of the popped element,
* formatted as [key, value]. If no element could be popped and the timeout expired, returns `null`.
*/
public blpop(keys: string[], timeout: number): T {
public blpop(keys: GlideString[], timeout: number): T {
return this.addAndReturn(createBLPop(keys, timeout));
}

Expand Down Expand Up @@ -3710,7 +3710,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
*
* Command Response - The length of the string after appending the value.
*/
public append(key: string, value: string): T {
public append(key: GlideString, value: GlideString): T {
return this.addAndReturn(createAppend(key, value));
}

Expand Down
Loading