Skip to content

Commit

Permalink
Node - Add binary support to transaction commands (#2187)
Browse files Browse the repository at this point in the history
add binary to transaction commands

Signed-off-by: lior sventitzky <[email protected]>
  • Loading branch information
liorsve authored Aug 22, 2024
1 parent 4c6ea2c commit 1bb9b13
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions node/src/Transaction.ts
Original file line number Diff line number Diff line change
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 @@ -500,7 +500,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 @@ -780,7 +780,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 @@ -926,7 +926,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 @@ -1026,7 +1026,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 @@ -1054,7 +1054,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 @@ -1067,7 +1067,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 @@ -1086,7 +1086,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 @@ -1098,7 +1098,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 @@ -1118,8 +1118,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 @@ -1149,8 +1149,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 @@ -1223,7 +1223,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 @@ -1251,7 +1251,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 @@ -1264,7 +1264,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 @@ -2430,7 +2430,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 @@ -2450,10 +2450,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 @@ -3007,7 +3007,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 @@ -3025,7 +3025,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 @@ -3741,7 +3741,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

0 comments on commit 1bb9b13

Please sign in to comment.