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]
|
||||
- `SISMEMBER`: `boolean` -> `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]
|
||||
- `GEOSEARCH_WITH`/`GEORADIUS_WITH`: `GeoReplyWith` -> `GEO_REPLY_WITH` [^enum-to-constants]
|
||||
- `GEORADIUSSTORE` -> `GEORADIUS_STORE`
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './BITCOUNT';
|
||||
import BITCOUNT from './BITCOUNT';
|
||||
|
||||
describe('BITCOUNT', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key'),
|
||||
BITCOUNT.transformArguments('key'),
|
||||
['BITCOUNT', 'key']
|
||||
);
|
||||
});
|
||||
@@ -14,7 +14,7 @@ describe('BITCOUNT', () => {
|
||||
describe('with range', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', {
|
||||
BITCOUNT.transformArguments('key', {
|
||||
start: 0,
|
||||
end: 1
|
||||
}),
|
||||
@@ -24,7 +24,7 @@ describe('BITCOUNT', () => {
|
||||
|
||||
it('with mode', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', {
|
||||
BITCOUNT.transformArguments('key', {
|
||||
start: 0,
|
||||
end: 1,
|
||||
mode: 'BIT'
|
||||
@@ -35,10 +35,13 @@ describe('BITCOUNT', () => {
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.bitCount', async client => {
|
||||
testUtils.testAll('bitCount', async client => {
|
||||
assert.equal(
|
||||
await client.bitCount('key'),
|
||||
0
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
}, {
|
||||
client: GLOBAL.SERVERS.OPEN,
|
||||
cluster: GLOBAL.CLUSTERS.OPEN
|
||||
});
|
||||
});
|
||||
|
@@ -1,49 +1,45 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './BITPOS';
|
||||
import BITPOS from './BITPOS';
|
||||
|
||||
describe('BITPOS', () => {
|
||||
describe.only('BITPOS', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', 1),
|
||||
BITPOS.transformArguments('key', 1),
|
||||
['BITPOS', 'key', '1']
|
||||
);
|
||||
});
|
||||
|
||||
it('with start', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', 1, 1),
|
||||
BITPOS.transformArguments('key', 1, 1),
|
||||
['BITPOS', 'key', '1', '1']
|
||||
);
|
||||
});
|
||||
|
||||
it('with start and end', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', 1, 1, -1),
|
||||
BITPOS.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.transformArguments('key', 1, 1, -1, 'BIT'),
|
||||
['BITPOS', 'key', '1', '1', '-1', 'BIT']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.bitPos', async client => {
|
||||
testUtils.testAll('bitPos', async client => {
|
||||
assert.equal(
|
||||
await client.bitPos('key', 1, 1),
|
||||
-1
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
testUtils.testWithCluster('cluster.bitPos', async cluster => {
|
||||
assert.equal(
|
||||
await cluster.bitPos('key', 1, 1),
|
||||
-1
|
||||
);
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
}, {
|
||||
client: GLOBAL.SERVERS.OPEN,
|
||||
cluster: GLOBAL.CLUSTERS.OPEN
|
||||
});
|
||||
});
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import LRANGE from './LRANGE';
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import LREM from './LREM';
|
||||
|
@@ -1,19 +1,22 @@
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments } from './SMOVE';
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import SMOVE from './SMOVE';
|
||||
|
||||
// describe('SMOVE', () => {
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments('source', 'destination', 'member'),
|
||||
// ['SMOVE', 'source', 'destination', 'member']
|
||||
// );
|
||||
// });
|
||||
describe('SMOVE', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
SMOVE.transformArguments('source', 'destination', 'member'),
|
||||
['SMOVE', 'source', 'destination', 'member']
|
||||
);
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.sMove', async client => {
|
||||
// assert.equal(
|
||||
// await client.sMove('source', 'destination', 'member'),
|
||||
// false
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
testUtils.testAll('sMove', async client => {
|
||||
assert.equal(
|
||||
await client.sMove('{tag}source', '{tag}destination', 'member'),
|
||||
0
|
||||
);
|
||||
}, {
|
||||
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 function transformArguments(
|
||||
// source: RedisCommandArgument,
|
||||
// destination: RedisCommandArgument,
|
||||
// member: RedisCommandArgument
|
||||
// ): RedisCommandArguments {
|
||||
// return ['SMOVE', source, destination, member];
|
||||
// }
|
||||
|
||||
// export { transformBooleanReply as transformReply } from './generic-transformers';
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(
|
||||
source: RedisArgument,
|
||||
destination: RedisArgument,
|
||||
member: RedisArgument
|
||||
) {
|
||||
return ['SMOVE', source, destination, member];
|
||||
},
|
||||
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(
|
||||
await client.sScan('key', 0),
|
||||
{
|
||||
@@ -48,5 +48,8 @@ describe('SSCAN', () => {
|
||||
members: []
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
}, {
|
||||
client: GLOBAL.SERVERS.OPEN,
|
||||
cluster: GLOBAL.CLUSTERS.OPEN
|
||||
});
|
||||
});
|
||||
|
@@ -1,28 +1,31 @@
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments } from './SUNION';
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import SUNION from './SUNION';
|
||||
|
||||
// describe('SUNION', () => {
|
||||
// describe('transformArguments', () => {
|
||||
// it('string', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments('key'),
|
||||
// ['SUNION', 'key']
|
||||
// );
|
||||
// });
|
||||
describe('SUNION', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('string', () => {
|
||||
assert.deepEqual(
|
||||
SUNION.transformArguments('key'),
|
||||
['SUNION', 'key']
|
||||
);
|
||||
});
|
||||
|
||||
// it('array', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments(['1', '2']),
|
||||
// ['SUNION', '1', '2']
|
||||
// );
|
||||
// });
|
||||
// });
|
||||
it('array', () => {
|
||||
assert.deepEqual(
|
||||
SUNION.transformArguments(['1', '2']),
|
||||
['SUNION', '1', '2']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.sUnion', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.sUnion('key'),
|
||||
// []
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
testUtils.testAll('sUnion', async client => {
|
||||
assert.deepEqual(
|
||||
await client.sUnion('key'),
|
||||
[]
|
||||
);
|
||||
}, {
|
||||
client: GLOBAL.SERVERS.OPEN,
|
||||
cluster: GLOBAL.CLUSTERS.OPEN
|
||||
});
|
||||
});
|
||||
|
@@ -1,14 +1,11 @@
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { pushVariadicArguments } from './generic-transformers';
|
||||
import { ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
// export function transformArguments(
|
||||
// keys: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
// ): RedisCommandArguments {
|
||||
// return pushVariadicArguments(['SUNION'], keys);
|
||||
// }
|
||||
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(keys: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['SUNION'], keys);
|
||||
},
|
||||
transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,28 +1,31 @@
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments } from './SUNIONSTORE';
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import SUNIONSTORE from './SUNIONSTORE';
|
||||
|
||||
// describe('SUNIONSTORE', () => {
|
||||
// describe('transformArguments', () => {
|
||||
// it('string', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments('destination', 'key'),
|
||||
// ['SUNIONSTORE', 'destination', 'key']
|
||||
// );
|
||||
// });
|
||||
describe('SUNIONSTORE', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('string', () => {
|
||||
assert.deepEqual(
|
||||
SUNIONSTORE.transformArguments('destination', 'key'),
|
||||
['SUNIONSTORE', 'destination', 'key']
|
||||
);
|
||||
});
|
||||
|
||||
// it('array', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments('destination', ['1', '2']),
|
||||
// ['SUNIONSTORE', 'destination', '1', '2']
|
||||
// );
|
||||
// });
|
||||
// });
|
||||
it('array', () => {
|
||||
assert.deepEqual(
|
||||
SUNIONSTORE.transformArguments('destination', ['1', '2']),
|
||||
['SUNIONSTORE', 'destination', '1', '2']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.sUnionStore', async client => {
|
||||
// assert.equal(
|
||||
// await client.sUnionStore('destination', 'key'),
|
||||
// 0
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
testUtils.testAll('sUnionStore', async client => {
|
||||
assert.equal(
|
||||
await client.sUnionStore('{tag}destination', '{tag}key'),
|
||||
0
|
||||
);
|
||||
}, {
|
||||
client: GLOBAL.SERVERS.OPEN,
|
||||
cluster: GLOBAL.CLUSTERS.OPEN
|
||||
});
|
||||
});
|
||||
|
@@ -1,13 +1,14 @@
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { pushVariadicArguments } from './generic-transformers';
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
// export function transformArguments(
|
||||
// destination: RedisCommandArgument,
|
||||
// keys: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
// ): RedisCommandArguments {
|
||||
// return pushVariadicArguments(['SUNIONSTORE', destination], keys);
|
||||
// }
|
||||
|
||||
// export declare function transformReply(): number;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(
|
||||
destination: RedisArgument,
|
||||
keys: RedisVariadicArgument
|
||||
) {
|
||||
return pushVariadicArguments(['SUNIONSTORE', destination], keys);
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -156,6 +156,7 @@ import SINTERSTORE from './SINTERSTORE';
|
||||
import SISMEMBER from './SISMEMBER';
|
||||
import SMEMBERS from './SMEMBERS';
|
||||
import SMISMEMBER from './SMISMEMBER';
|
||||
import SMOVE from './SMOVE';
|
||||
import SORT_RO from './SORT_RO';
|
||||
import SORT_STORE from './SORT_STORE';
|
||||
import SORT from './SORT';
|
||||
@@ -167,6 +168,8 @@ import SRANDMEMBER from './SRANDMEMBER';
|
||||
import SREM from './SREM';
|
||||
import SSCAN from './SSCAN';
|
||||
import STRLEN from './STRLEN';
|
||||
import SUNION from './SUNION';
|
||||
import SUNIONSTORE from './SUNIONSTORE';
|
||||
import TOUCH from './TOUCH';
|
||||
import TTL from './TTL';
|
||||
import TYPE from './TYPE';
|
||||
@@ -530,6 +533,8 @@ export default {
|
||||
sMembers: SMEMBERS,
|
||||
SMISMEMBER,
|
||||
smIsMember: SMISMEMBER,
|
||||
SMOVE,
|
||||
sMove: SMOVE,
|
||||
SORT_RO,
|
||||
sortRo: SORT_RO,
|
||||
SORT_STORE,
|
||||
@@ -552,6 +557,10 @@ export default {
|
||||
sScan: SSCAN,
|
||||
STRLEN,
|
||||
strLen: STRLEN,
|
||||
SUNION,
|
||||
sUnion: SUNION,
|
||||
SUNIONSTORE,
|
||||
sUnionStore: SUNIONSTORE,
|
||||
TOUCH,
|
||||
touch: TOUCH,
|
||||
TTL,
|
||||
|
Reference in New Issue
Block a user