You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
more commands
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './DICTDUMP';
|
||||
import DICTDUMP from './DICTDUMP';
|
||||
|
||||
describe('DICTDUMP', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('dictionary'),
|
||||
['FT.DICTDUMP', 'dictionary']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
DICTDUMP.transformArguments('dictionary'),
|
||||
['FT.DICTDUMP', 'dictionary']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.ft.dictDump', async client => {
|
||||
await client.ft.dictAdd('dictionary', 'string')
|
||||
testUtils.testWithClient('client.ft.dictDump', async client => {
|
||||
await client.ft.dictAdd('dictionary', 'string')
|
||||
|
||||
assert.deepEqual(
|
||||
await client.ft.dictDump('dictionary'),
|
||||
['string']
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
assert.deepEqual(
|
||||
await client.ft.dictDump('dictionary'),
|
||||
['string']
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,5 +1,13 @@
|
||||
export function transformArguments(dictionary: string): Array<string> {
|
||||
return ['FT.DICTDUMP', dictionary];
|
||||
}
|
||||
import { RedisArgument, ArrayReply, SetReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
export declare function transformReply(): Array<string>;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(dictionary: RedisArgument) {
|
||||
return ['FT.DICTDUMP', dictionary];
|
||||
},
|
||||
transformReply: {
|
||||
2: undefined as unknown as () => ArrayReply<BlobStringReply>,
|
||||
3: undefined as unknown as () => SetReply<BlobStringReply>
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,33 +1,33 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { SchemaFieldTypes } from '.';
|
||||
import { transformArguments } from './DROPINDEX';
|
||||
import DROPINDEX from './DROPINDEX';
|
||||
|
||||
describe('DROPINDEX', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('without options', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('index'),
|
||||
['FT.DROPINDEX', 'index']
|
||||
);
|
||||
});
|
||||
|
||||
it('with DD', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('index', { DD: true }),
|
||||
['FT.DROPINDEX', 'index', 'DD']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('without options', () => {
|
||||
assert.deepEqual(
|
||||
DROPINDEX.transformArguments('index'),
|
||||
['FT.DROPINDEX', 'index']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.ft.dropIndex', async client => {
|
||||
await client.ft.create('index', {
|
||||
field: SchemaFieldTypes.TEXT
|
||||
});
|
||||
it('with DD', () => {
|
||||
assert.deepEqual(
|
||||
DROPINDEX.transformArguments('index', { DD: true }),
|
||||
['FT.DROPINDEX', 'index', 'DD']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
await client.ft.dropIndex('index'),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithClient('client.ft.dropIndex', async client => {
|
||||
await client.ft.create('index', {
|
||||
field: SchemaFieldTypes.TEXT
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
await client.ft.dropIndex('index'),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,15 +1,23 @@
|
||||
interface DropIndexOptions {
|
||||
DD?: true;
|
||||
import { RedisArgument, SimpleStringReply, NumberReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
export interface FtDropIndexOptions {
|
||||
DD?: true;
|
||||
}
|
||||
|
||||
export function transformArguments(index: string, options?: DropIndexOptions): Array<string> {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(index: RedisArgument, options?: FtDropIndexOptions) {
|
||||
const args = ['FT.DROPINDEX', index];
|
||||
|
||||
if (options?.DD) {
|
||||
args.push('DD');
|
||||
args.push('DD');
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
export declare function transformReply(): 'OK';
|
||||
},
|
||||
transformReply: {
|
||||
2: undefined as unknown as () => SimpleStringReply<'OK'>,
|
||||
3: undefined as unknown as () => NumberReply
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,24 +1,24 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { SchemaFieldTypes } from '.';
|
||||
import { transformArguments } from './TAGVALS';
|
||||
import TAGVALS from './TAGVALS';
|
||||
|
||||
describe('TAGVALS', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('index', '@field'),
|
||||
['FT.TAGVALS', 'index', '@field']
|
||||
);
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
TAGVALS.transformArguments('index', '@field'),
|
||||
['FT.TAGVALS', 'index', '@field']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.ft.tagVals', async client => {
|
||||
await client.ft.create('index', {
|
||||
field: SchemaFieldTypes.TAG
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.ft.tagVals', async client => {
|
||||
await client.ft.create('index', {
|
||||
field: SchemaFieldTypes.TAG
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
await client.ft.tagVals('index', 'field'),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
assert.deepEqual(
|
||||
await client.ft.tagVals('index', 'field'),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,5 +1,13 @@
|
||||
export function transformArguments(index: string, fieldName: string): Array<string> {
|
||||
return ['FT.TAGVALS', index, fieldName];
|
||||
}
|
||||
import { RedisArgument, ArrayReply, SetReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
export declare function transformReply(): Array<string>;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(index: RedisArgument, fieldName: RedisArgument) {
|
||||
return ['FT.TAGVALS', index, fieldName];
|
||||
},
|
||||
transformReply: {
|
||||
2: undefined as unknown as () => ArrayReply<BlobStringReply>,
|
||||
3: undefined as unknown as () => SetReply<BlobStringReply>
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,19 +1,19 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './_LIST';
|
||||
import _LIST from './_LIST';
|
||||
|
||||
describe('_LIST', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['FT._LIST']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
_LIST.transformArguments(),
|
||||
['FT._LIST']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.ft._list', async client => {
|
||||
assert.deepEqual(
|
||||
await client.ft._list(),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithClient('client.ft._list', async client => {
|
||||
assert.deepEqual(
|
||||
await client.ft._list(),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,5 +1,13 @@
|
||||
export function transformArguments(): Array<string> {
|
||||
return ['FT._LIST'];
|
||||
}
|
||||
import { ArrayReply, SetReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
export declare function transformReply(): Array<string>;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['FT._LIST'];
|
||||
},
|
||||
transformReply: {
|
||||
2: undefined as unknown as () => ArrayReply<BlobStringReply>,
|
||||
3: undefined as unknown as () => SetReply<BlobStringReply>
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
Reference in New Issue
Block a user