You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Merge branch 'v5' of github.com:leibale/node-redis into v5
This commit is contained in:
@@ -99,6 +99,7 @@ Some command arguments/replies have changed to align more closely to data types
|
|||||||
- `SCRIPT EXISTS`: `Array<boolean>` -> `Array<number>` [^boolean-to-number]
|
- `SCRIPT EXISTS`: `Array<boolean>` -> `Array<number>` [^boolean-to-number]
|
||||||
- `SISMEMBER`: `boolean` -> `number` [^boolean-to-number]
|
- `SISMEMBER`: `boolean` -> `number` [^boolean-to-number]
|
||||||
- `SMISMEMBER`: `Array<boolean>` -> `Array<number>` [^boolean-to-number]
|
- `SMISMEMBER`: `Array<boolean>` -> `Array<number>` [^boolean-to-number]
|
||||||
|
- `SMOVE`: `boolean` -> `number` [^boolean-to-number]
|
||||||
- `TS.ADD`: `boolean` -> `number` [^boolean-to-number]
|
- `TS.ADD`: `boolean` -> `number` [^boolean-to-number]
|
||||||
- `GEOSEARCH_WITH`/`GEORADIUS_WITH`: `GeoReplyWith` -> `GEO_REPLY_WITH` [^enum-to-constants]
|
- `GEOSEARCH_WITH`/`GEORADIUS_WITH`: `GeoReplyWith` -> `GEO_REPLY_WITH` [^enum-to-constants]
|
||||||
- `GEORADIUSSTORE` -> `GEORADIUS_STORE`
|
- `GEORADIUSSTORE` -> `GEORADIUS_STORE`
|
||||||
|
@@ -1,44 +1,47 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
import { transformArguments } from './BITCOUNT';
|
import BITCOUNT from './BITCOUNT';
|
||||||
|
|
||||||
describe('BITCOUNT', () => {
|
describe('BITCOUNT', () => {
|
||||||
describe('transformArguments', () => {
|
describe('transformArguments', () => {
|
||||||
it('simple', () => {
|
it('simple', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('key'),
|
BITCOUNT.transformArguments('key'),
|
||||||
['BITCOUNT', 'key']
|
['BITCOUNT', 'key']
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
describe('with range', () => {
|
|
||||||
it('simple', () => {
|
|
||||||
assert.deepEqual(
|
|
||||||
transformArguments('key', {
|
|
||||||
start: 0,
|
|
||||||
end: 1
|
|
||||||
}),
|
|
||||||
['BITCOUNT', 'key', '0', '1']
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('with mode', () => {
|
|
||||||
assert.deepEqual(
|
|
||||||
transformArguments('key', {
|
|
||||||
start: 0,
|
|
||||||
end: 1,
|
|
||||||
mode: 'BIT'
|
|
||||||
}),
|
|
||||||
['BITCOUNT', 'key', '0', '1', 'BIT']
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUtils.testWithClient('client.bitCount', async client => {
|
describe('with range', () => {
|
||||||
assert.equal(
|
it('simple', () => {
|
||||||
await client.bitCount('key'),
|
assert.deepEqual(
|
||||||
0
|
BITCOUNT.transformArguments('key', {
|
||||||
|
start: 0,
|
||||||
|
end: 1
|
||||||
|
}),
|
||||||
|
['BITCOUNT', 'key', '0', '1']
|
||||||
);
|
);
|
||||||
}, GLOBAL.SERVERS.OPEN);
|
});
|
||||||
|
|
||||||
|
it('with mode', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
BITCOUNT.transformArguments('key', {
|
||||||
|
start: 0,
|
||||||
|
end: 1,
|
||||||
|
mode: 'BIT'
|
||||||
|
}),
|
||||||
|
['BITCOUNT', 'key', '0', '1', 'BIT']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testAll('bitCount', async client => {
|
||||||
|
assert.equal(
|
||||||
|
await client.bitCount('key'),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}, {
|
||||||
|
client: GLOBAL.SERVERS.OPEN,
|
||||||
|
cluster: GLOBAL.CLUSTERS.OPEN
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,49 +1,45 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
import { transformArguments } from './BITPOS';
|
import BITPOS from './BITPOS';
|
||||||
|
|
||||||
describe('BITPOS', () => {
|
describe.only('BITPOS', () => {
|
||||||
describe('transformArguments', () => {
|
describe('transformArguments', () => {
|
||||||
it('simple', () => {
|
it('simple', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('key', 1),
|
BITPOS.transformArguments('key', 1),
|
||||||
['BITPOS', 'key', '1']
|
['BITPOS', 'key', '1']
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
it('with start', () => {
|
|
||||||
assert.deepEqual(
|
|
||||||
transformArguments('key', 1, 1),
|
|
||||||
['BITPOS', 'key', '1', '1']
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('with start and end', () => {
|
|
||||||
assert.deepEqual(
|
|
||||||
transformArguments('key', 1, 1, -1),
|
|
||||||
['BITPOS', 'key', '1', '1', '-1']
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('with start, end and mode', () => {
|
|
||||||
assert.deepEqual(
|
|
||||||
transformArguments('key', 1, 1, -1, 'BIT'),
|
|
||||||
['BITPOS', 'key', '1', '1', '-1', 'BIT']
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUtils.testWithClient('client.bitPos', async client => {
|
it('with start', () => {
|
||||||
assert.equal(
|
assert.deepEqual(
|
||||||
await client.bitPos('key', 1, 1),
|
BITPOS.transformArguments('key', 1, 1),
|
||||||
-1
|
['BITPOS', 'key', '1', '1']
|
||||||
);
|
);
|
||||||
}, GLOBAL.SERVERS.OPEN);
|
});
|
||||||
|
|
||||||
testUtils.testWithCluster('cluster.bitPos', async cluster => {
|
it('with start and end', () => {
|
||||||
assert.equal(
|
assert.deepEqual(
|
||||||
await cluster.bitPos('key', 1, 1),
|
BITPOS.transformArguments('key', 1, 1, -1),
|
||||||
-1
|
['BITPOS', 'key', '1', '1', '-1']
|
||||||
);
|
);
|
||||||
}, GLOBAL.CLUSTERS.OPEN);
|
});
|
||||||
|
|
||||||
|
it('with start, end and mode', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
BITPOS.transformArguments('key', 1, 1, -1, 'BIT'),
|
||||||
|
['BITPOS', 'key', '1', '1', '-1', 'BIT']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testAll('bitPos', async client => {
|
||||||
|
assert.equal(
|
||||||
|
await client.bitPos('key', 1, 1),
|
||||||
|
-1
|
||||||
|
);
|
||||||
|
}, {
|
||||||
|
client: GLOBAL.SERVERS.OPEN,
|
||||||
|
cluster: GLOBAL.CLUSTERS.OPEN
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
import LRANGE from './LRANGE';
|
import LRANGE from './LRANGE';
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
import LREM from './LREM';
|
import LREM from './LREM';
|
||||||
|
@@ -1,19 +1,22 @@
|
|||||||
// import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
// import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
// import { transformArguments } from './SMOVE';
|
import SMOVE from './SMOVE';
|
||||||
|
|
||||||
// describe('SMOVE', () => {
|
describe('SMOVE', () => {
|
||||||
// it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
// assert.deepEqual(
|
assert.deepEqual(
|
||||||
// transformArguments('source', 'destination', 'member'),
|
SMOVE.transformArguments('source', 'destination', 'member'),
|
||||||
// ['SMOVE', 'source', 'destination', 'member']
|
['SMOVE', 'source', 'destination', 'member']
|
||||||
// );
|
);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// testUtils.testWithClient('client.sMove', async client => {
|
testUtils.testAll('sMove', async client => {
|
||||||
// assert.equal(
|
assert.equal(
|
||||||
// await client.sMove('source', 'destination', 'member'),
|
await client.sMove('{tag}source', '{tag}destination', 'member'),
|
||||||
// false
|
0
|
||||||
// );
|
);
|
||||||
// }, GLOBAL.SERVERS.OPEN);
|
}, {
|
||||||
// });
|
client: GLOBAL.SERVERS.OPEN,
|
||||||
|
cluster: GLOBAL.CLUSTERS.OPEN
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||||
|
|
||||||
// export const FIRST_KEY_INDEX = 1;
|
export default {
|
||||||
|
FIRST_KEY_INDEX: 1,
|
||||||
// export function transformArguments(
|
IS_READ_ONLY: false,
|
||||||
// source: RedisCommandArgument,
|
transformArguments(
|
||||||
// destination: RedisCommandArgument,
|
source: RedisArgument,
|
||||||
// member: RedisCommandArgument
|
destination: RedisArgument,
|
||||||
// ): RedisCommandArguments {
|
member: RedisArgument
|
||||||
// return ['SMOVE', source, destination, member];
|
) {
|
||||||
// }
|
return ['SMOVE', source, destination, member];
|
||||||
|
},
|
||||||
// export { transformBooleanReply as transformReply } from './generic-transformers';
|
transformReply: undefined as unknown as () => NumberReply
|
||||||
|
} as const satisfies Command;
|
||||||
|
@@ -40,7 +40,7 @@ describe('SSCAN', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
testUtils.testWithClient('client.sScan', async client => {
|
testUtils.testAll('sScan', async client => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
await client.sScan('key', 0),
|
await client.sScan('key', 0),
|
||||||
{
|
{
|
||||||
@@ -48,5 +48,8 @@ describe('SSCAN', () => {
|
|||||||
members: []
|
members: []
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}, GLOBAL.SERVERS.OPEN);
|
}, {
|
||||||
|
client: GLOBAL.SERVERS.OPEN,
|
||||||
|
cluster: GLOBAL.CLUSTERS.OPEN
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,28 +1,31 @@
|
|||||||
// import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
// import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
// import { transformArguments } from './SUNION';
|
import SUNION from './SUNION';
|
||||||
|
|
||||||
// describe('SUNION', () => {
|
describe('SUNION', () => {
|
||||||
// describe('transformArguments', () => {
|
describe('transformArguments', () => {
|
||||||
// it('string', () => {
|
it('string', () => {
|
||||||
// assert.deepEqual(
|
assert.deepEqual(
|
||||||
// transformArguments('key'),
|
SUNION.transformArguments('key'),
|
||||||
// ['SUNION', 'key']
|
['SUNION', 'key']
|
||||||
// );
|
);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// it('array', () => {
|
it('array', () => {
|
||||||
// assert.deepEqual(
|
assert.deepEqual(
|
||||||
// transformArguments(['1', '2']),
|
SUNION.transformArguments(['1', '2']),
|
||||||
// ['SUNION', '1', '2']
|
['SUNION', '1', '2']
|
||||||
// );
|
);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
||||||
// testUtils.testWithClient('client.sUnion', async client => {
|
testUtils.testAll('sUnion', async client => {
|
||||||
// assert.deepEqual(
|
assert.deepEqual(
|
||||||
// await client.sUnion('key'),
|
await client.sUnion('key'),
|
||||||
// []
|
[]
|
||||||
// );
|
);
|
||||||
// }, GLOBAL.SERVERS.OPEN);
|
}, {
|
||||||
// });
|
client: GLOBAL.SERVERS.OPEN,
|
||||||
|
cluster: GLOBAL.CLUSTERS.OPEN
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -1,14 +1,11 @@
|
|||||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
import { ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||||
// import { pushVariadicArguments } from './generic-transformers';
|
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||||
|
|
||||||
// export const FIRST_KEY_INDEX = 1;
|
export default {
|
||||||
|
FIRST_KEY_INDEX: 1,
|
||||||
// export const IS_READ_ONLY = true;
|
IS_READ_ONLY: true,
|
||||||
|
transformArguments(keys: RedisVariadicArgument) {
|
||||||
// export function transformArguments(
|
return pushVariadicArguments(['SUNION'], keys);
|
||||||
// keys: RedisCommandArgument | Array<RedisCommandArgument>
|
},
|
||||||
// ): RedisCommandArguments {
|
transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
|
||||||
// return pushVariadicArguments(['SUNION'], keys);
|
} as const satisfies Command;
|
||||||
// }
|
|
||||||
|
|
||||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
|
||||||
|
@@ -1,28 +1,31 @@
|
|||||||
// import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
// import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
// import { transformArguments } from './SUNIONSTORE';
|
import SUNIONSTORE from './SUNIONSTORE';
|
||||||
|
|
||||||
// describe('SUNIONSTORE', () => {
|
describe('SUNIONSTORE', () => {
|
||||||
// describe('transformArguments', () => {
|
describe('transformArguments', () => {
|
||||||
// it('string', () => {
|
it('string', () => {
|
||||||
// assert.deepEqual(
|
assert.deepEqual(
|
||||||
// transformArguments('destination', 'key'),
|
SUNIONSTORE.transformArguments('destination', 'key'),
|
||||||
// ['SUNIONSTORE', 'destination', 'key']
|
['SUNIONSTORE', 'destination', 'key']
|
||||||
// );
|
);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// it('array', () => {
|
it('array', () => {
|
||||||
// assert.deepEqual(
|
assert.deepEqual(
|
||||||
// transformArguments('destination', ['1', '2']),
|
SUNIONSTORE.transformArguments('destination', ['1', '2']),
|
||||||
// ['SUNIONSTORE', 'destination', '1', '2']
|
['SUNIONSTORE', 'destination', '1', '2']
|
||||||
// );
|
);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
||||||
// testUtils.testWithClient('client.sUnionStore', async client => {
|
testUtils.testAll('sUnionStore', async client => {
|
||||||
// assert.equal(
|
assert.equal(
|
||||||
// await client.sUnionStore('destination', 'key'),
|
await client.sUnionStore('{tag}destination', '{tag}key'),
|
||||||
// 0
|
0
|
||||||
// );
|
);
|
||||||
// }, GLOBAL.SERVERS.OPEN);
|
}, {
|
||||||
// });
|
client: GLOBAL.SERVERS.OPEN,
|
||||||
|
cluster: GLOBAL.CLUSTERS.OPEN
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||||
// import { pushVariadicArguments } from './generic-transformers';
|
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||||
|
|
||||||
// export const FIRST_KEY_INDEX = 1;
|
export default {
|
||||||
|
FIRST_KEY_INDEX: 1,
|
||||||
// export function transformArguments(
|
IS_READ_ONLY: false,
|
||||||
// destination: RedisCommandArgument,
|
transformArguments(
|
||||||
// keys: RedisCommandArgument | Array<RedisCommandArgument>
|
destination: RedisArgument,
|
||||||
// ): RedisCommandArguments {
|
keys: RedisVariadicArgument
|
||||||
// return pushVariadicArguments(['SUNIONSTORE', destination], keys);
|
) {
|
||||||
// }
|
return pushVariadicArguments(['SUNIONSTORE', destination], keys);
|
||||||
|
},
|
||||||
// export declare function transformReply(): number;
|
transformReply: undefined as unknown as () => NumberReply
|
||||||
|
} as const satisfies Command;
|
||||||
|
@@ -156,6 +156,7 @@ import SINTERSTORE from './SINTERSTORE';
|
|||||||
import SISMEMBER from './SISMEMBER';
|
import SISMEMBER from './SISMEMBER';
|
||||||
import SMEMBERS from './SMEMBERS';
|
import SMEMBERS from './SMEMBERS';
|
||||||
import SMISMEMBER from './SMISMEMBER';
|
import SMISMEMBER from './SMISMEMBER';
|
||||||
|
import SMOVE from './SMOVE';
|
||||||
import SORT_RO from './SORT_RO';
|
import SORT_RO from './SORT_RO';
|
||||||
import SORT_STORE from './SORT_STORE';
|
import SORT_STORE from './SORT_STORE';
|
||||||
import SORT from './SORT';
|
import SORT from './SORT';
|
||||||
@@ -167,6 +168,8 @@ import SRANDMEMBER from './SRANDMEMBER';
|
|||||||
import SREM from './SREM';
|
import SREM from './SREM';
|
||||||
import SSCAN from './SSCAN';
|
import SSCAN from './SSCAN';
|
||||||
import STRLEN from './STRLEN';
|
import STRLEN from './STRLEN';
|
||||||
|
import SUNION from './SUNION';
|
||||||
|
import SUNIONSTORE from './SUNIONSTORE';
|
||||||
import TOUCH from './TOUCH';
|
import TOUCH from './TOUCH';
|
||||||
import TTL from './TTL';
|
import TTL from './TTL';
|
||||||
import TYPE from './TYPE';
|
import TYPE from './TYPE';
|
||||||
@@ -530,6 +533,8 @@ export default {
|
|||||||
sMembers: SMEMBERS,
|
sMembers: SMEMBERS,
|
||||||
SMISMEMBER,
|
SMISMEMBER,
|
||||||
smIsMember: SMISMEMBER,
|
smIsMember: SMISMEMBER,
|
||||||
|
SMOVE,
|
||||||
|
sMove: SMOVE,
|
||||||
SORT_RO,
|
SORT_RO,
|
||||||
sortRo: SORT_RO,
|
sortRo: SORT_RO,
|
||||||
SORT_STORE,
|
SORT_STORE,
|
||||||
@@ -552,6 +557,10 @@ export default {
|
|||||||
sScan: SSCAN,
|
sScan: SSCAN,
|
||||||
STRLEN,
|
STRLEN,
|
||||||
strLen: STRLEN,
|
strLen: STRLEN,
|
||||||
|
SUNION,
|
||||||
|
sUnion: SUNION,
|
||||||
|
SUNIONSTORE,
|
||||||
|
sUnionStore: SUNIONSTORE,
|
||||||
TOUCH,
|
TOUCH,
|
||||||
touch: TOUCH,
|
touch: TOUCH,
|
||||||
TTL,
|
TTL,
|
||||||
|
Reference in New Issue
Block a user