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

Change object command names to follow camel-case #1559

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* Python: Added ZINTER, ZUNION commands ([#1478](https://github.com/aws/glide-for-redis/pull/1478))
* Python: Added SINTERCARD command ([#1511](https://github.com/aws/glide-for-redis/pull/1511))
* Python: Added SORT command ([#1439](https://github.com/aws/glide-for-redis/pull/1439))
* Node: Added OBJECT ENCODING command ([#1518](https://github.com/aws/glide-for-redis/pull/1518))
* Node: Added OBJECT ENCODING command ([#1518](https://github.com/aws/glide-for-redis/pull/1518), [#1559](https://github.com/aws/glide-for-redis/pull/1559))
* Python: Added LMOVE and BLMOVE commands ([#1536](https://github.com/aws/glide-for-redis/pull/1536))
* Node: Added SUNIONSTORE command ([#1549](https://github.com/aws/glide-for-redis/pull/1549))
* Node: Added PFCOUNT command ([#1545](https://github.com/aws/glide-for-redis/pull/1545))
* Node: Added OBJECT FREQ command ([#1542](https://github.com/aws/glide-for-redis/pull/1542))
* Node: Added OBJECT FREQ command ([#1542](https://github.com/aws/glide-for-redis/pull/1542), [#1559](https://github.com/aws/glide-for-redis/pull/1559))
* Node: Added LINSERT command ([#1544](https://github.com/aws/glide-for-redis/pull/1544))
* Node: Added XLEN command ([#1555](https://github.com/aws/glide-for-redis/pull/1555))

Expand Down
8 changes: 4 additions & 4 deletions node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2525,11 +2525,11 @@ export class BaseClient {
* Otherwise, returns None.
* @example
* ```typescript
* const result = await client.object_encoding("my_hash");
* const result = await client.objectEncoding("my_hash");
* console.log(result); // Output: "listpack"
* ```
*/
public object_encoding(key: string): Promise<string | null> {
public objectEncoding(key: string): Promise<string | null> {
return this.createWritePromise(createObjectEncoding(key));
}

Expand All @@ -2542,11 +2542,11 @@ export class BaseClient {
* stored at `key` as a `number`. Otherwise, returns `null`.
* @example
* ```typescript
* const result = await client.object_freq("my_hash");
* const result = await client.objectFreq("my_hash");
* console.log(result); // Output: 2 - The logarithmic access frequency counter of "my_hash".
* ```
*/
public object_freq(key: string): Promise<number | null> {
public objectFreq(key: string): Promise<number | null> {
return this.createWritePromise(createObjectFreq(key));
}

Expand Down
4 changes: 2 additions & 2 deletions node/src/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - If `key` exists, returns the internal encoding of the object stored at `key` as a string.
* Otherwise, returns None.
*/
public object_encoding(key: string): T {
public objectEncoding(key: string): T {
return this.addAndReturn(createObjectEncoding(key));
}

Expand All @@ -1472,7 +1472,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - If `key` exists, returns the logarithmic access frequency counter of
* the object stored at `key` as a `number`. Otherwise, returns `null`.
*/
public object_freq(key: string): T {
public objectFreq(key: string): T {
return this.addAndReturn(createObjectFreq(key));
}
}
Expand Down
2 changes: 1 addition & 1 deletion node/tests/RedisClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe("RedisClient", () => {
[maxmemoryPolicyKey]: "allkeys-lfu",
});
transaction.set(key, "foo");
transaction.object_freq(key);
transaction.objectFreq(key);

const response = await client.exec(transaction);
expect(response).not.toBeNull();
Expand Down
2 changes: 1 addition & 1 deletion node/tests/RedisClusterClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ describe("RedisClusterClient", () => {
[maxmemoryPolicyKey]: "allkeys-lfu",
});
transaction.set(key, "foo");
transaction.object_freq(key);
transaction.objectFreq(key);

const response = await client.exec(transaction);
expect(response).not.toBeNull();
Expand Down
46 changes: 23 additions & 23 deletions node/tests/SharedTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3054,7 +3054,7 @@ export function runBaseTests<Context>(config: {
const versionLessThan72 =
await checkIfServerVersionLessThan("7.2.0");

expect(await client.object_encoding(non_existing_key)).toEqual(
expect(await client.objectEncoding(non_existing_key)).toEqual(
null,
);

Expand All @@ -3064,24 +3064,24 @@ export function runBaseTests<Context>(config: {
"a really loooooooooooooooooooooooooooooooooooooooong value",
),
).toEqual("OK");
expect(await client.object_encoding(string_key)).toEqual("raw");
expect(await client.objectEncoding(string_key)).toEqual("raw");

expect(await client.set(string_key, "2")).toEqual("OK");
expect(await client.object_encoding(string_key)).toEqual("int");
expect(await client.objectEncoding(string_key)).toEqual("int");

expect(await client.set(string_key, "value")).toEqual("OK");
expect(await client.object_encoding(string_key)).toEqual(
expect(await client.objectEncoding(string_key)).toEqual(
"embstr",
);

expect(await client.lpush(list_key, ["1"])).toEqual(1);

if (versionLessThan7) {
expect(await client.object_encoding(list_key)).toEqual(
expect(await client.objectEncoding(list_key)).toEqual(
"quicklist",
);
} else {
expect(await client.object_encoding(list_key)).toEqual(
expect(await client.objectEncoding(list_key)).toEqual(
"listpack",
);
}
Expand All @@ -3093,24 +3093,24 @@ export function runBaseTests<Context>(config: {
).toEqual(1);
}

expect(await client.object_encoding(hashtable_key)).toEqual(
expect(await client.objectEncoding(hashtable_key)).toEqual(
"hashtable",
);

expect(await client.sadd(intset_key, ["1"])).toEqual(1);
expect(await client.object_encoding(intset_key)).toEqual(
expect(await client.objectEncoding(intset_key)).toEqual(
"intset",
);

expect(await client.sadd(set_listpack_key, ["foo"])).toEqual(1);

if (versionLessThan72) {
expect(
await client.object_encoding(set_listpack_key),
await client.objectEncoding(set_listpack_key),
).toEqual("hashtable");
} else {
expect(
await client.object_encoding(set_listpack_key),
await client.objectEncoding(set_listpack_key),
).toEqual("listpack");
}

Expand All @@ -3123,21 +3123,21 @@ export function runBaseTests<Context>(config: {
).toEqual(1);
}

expect(
await client.object_encoding(hash_hashtable_key),
).toEqual("hashtable");
expect(await client.objectEncoding(hash_hashtable_key)).toEqual(
"hashtable",
);

expect(
await client.hset(hash_listpack_key, { "1": "2" }),
).toEqual(1);

if (versionLessThan7) {
expect(
await client.object_encoding(hash_listpack_key),
await client.objectEncoding(hash_listpack_key),
).toEqual("ziplist");
} else {
expect(
await client.object_encoding(hash_listpack_key),
await client.objectEncoding(hash_listpack_key),
).toEqual("listpack");
}

Expand All @@ -3148,7 +3148,7 @@ export function runBaseTests<Context>(config: {
).toEqual(1);
}

expect(await client.object_encoding(skiplist_key)).toEqual(
expect(await client.objectEncoding(skiplist_key)).toEqual(
"skiplist",
);

Expand All @@ -3158,18 +3158,18 @@ export function runBaseTests<Context>(config: {

if (versionLessThan7) {
expect(
await client.object_encoding(zset_listpack_key),
await client.objectEncoding(zset_listpack_key),
).toEqual("ziplist");
} else {
expect(
await client.object_encoding(zset_listpack_key),
await client.objectEncoding(zset_listpack_key),
).toEqual("listpack");
}

expect(
await client.xadd(stream_key, [["field", "value"]]),
).not.toBeNull();
expect(await client.object_encoding(stream_key)).toEqual(
expect(await client.objectEncoding(stream_key)).toEqual(
"stream",
);
}, protocol);
Expand All @@ -3193,13 +3193,13 @@ export function runBaseTests<Context>(config: {
[maxmemoryPolicyKey]: "allkeys-lfu",
}),
).toEqual("OK");
expect(await client.object_freq(nonExistingKey)).toEqual(
expect(await client.objectFreq(nonExistingKey)).toEqual(
null,
);
expect(await client.set(key, "foobar")).toEqual("OK");
expect(
await client.object_freq(key),
).toBeGreaterThanOrEqual(0);
expect(await client.objectFreq(key)).toBeGreaterThanOrEqual(
0,
);
} finally {
expect(
await client.configSet({
Expand Down
2 changes: 1 addition & 1 deletion node/tests/TestUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export async function transactionTest(
const args: ReturnType[] = [];
baseTransaction.set(key1, "bar");
args.push("OK");
baseTransaction.object_encoding(key1);
baseTransaction.objectEncoding(key1);
args.push("embstr");
baseTransaction.type(key1);
args.push("string");
Expand Down
Loading