You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
export RediSearchSchema type (#1825)
* export RediSearchSchema type * export SearchOptions and SearchReply
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { CreateSchema, pushSchema } from '.';
|
import { RediSearchSchema, pushSchema } from '.';
|
||||||
|
|
||||||
export function transformArguments(index: string, schema: CreateSchema): Array<string> {
|
export function transformArguments(index: string, schema: RediSearchSchema): Array<string> {
|
||||||
const args = ['FT.ALTER', index, 'SCHEMA', 'ADD'];
|
const args = ['FT.ALTER', index, 'SCHEMA', 'ADD'];
|
||||||
pushSchema(args, schema);
|
pushSchema(args, schema);
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { pushOptionalVerdictArgument } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
import { pushOptionalVerdictArgument } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
||||||
import { RedisSearchLanguages, PropertyName, CreateSchema, pushSchema } from '.';
|
import { RedisSearchLanguages, PropertyName, RediSearchSchema, pushSchema } from '.';
|
||||||
|
|
||||||
interface CreateOptions {
|
interface CreateOptions {
|
||||||
ON?: 'HASH' | 'JSON';
|
ON?: 'HASH' | 'JSON';
|
||||||
@@ -20,7 +20,7 @@ interface CreateOptions {
|
|||||||
STOPWORDS?: string | Array<string>;
|
STOPWORDS?: string | Array<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(index: string, schema: CreateSchema, options?: CreateOptions): Array<string> {
|
export function transformArguments(index: string, schema: RediSearchSchema, options?: CreateOptions): Array<string> {
|
||||||
const args = ['FT.CREATE', index];
|
const args = ['FT.CREATE', index];
|
||||||
|
|
||||||
if (options?.ON) {
|
if (options?.ON) {
|
||||||
|
@@ -204,7 +204,7 @@ type CreateSchemaTagField = CreateSchemaField<SchemaFieldTypes.TAG, {
|
|||||||
CASESENSITIVE?: true;
|
CASESENSITIVE?: true;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export interface CreateSchema {
|
export interface RediSearchSchema {
|
||||||
[field: string]:
|
[field: string]:
|
||||||
CreateSchemaTextField |
|
CreateSchemaTextField |
|
||||||
CreateSchemaNumericField |
|
CreateSchemaNumericField |
|
||||||
@@ -212,7 +212,7 @@ export interface CreateSchema {
|
|||||||
CreateSchemaTagField
|
CreateSchemaTagField
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pushSchema(args: RedisCommandArguments, schema: CreateSchema) {
|
export function pushSchema(args: RedisCommandArguments, schema: RediSearchSchema) {
|
||||||
for (const [field, fieldOptions] of Object.entries(schema)) {
|
for (const [field, fieldOptions] of Object.entries(schema)) {
|
||||||
args.push(field);
|
args.push(field);
|
||||||
|
|
||||||
@@ -396,7 +396,6 @@ export interface SearchReply {
|
|||||||
}>;
|
}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface ProfileOptions {
|
export interface ProfileOptions {
|
||||||
LIMITED?: true;
|
LIMITED?: true;
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
export { default } from './commands';
|
export { default } from './commands';
|
||||||
|
|
||||||
export { SchemaFieldTypes, SchemaTextFieldPhonetics } from './commands';
|
export { RediSearchSchema, SchemaFieldTypes, SchemaTextFieldPhonetics, SearchReply } from './commands';
|
||||||
export { AggregateSteps, AggregateGroupByReducers } from './commands/AGGREGATE';
|
export { AggregateSteps, AggregateGroupByReducers } from './commands/AGGREGATE';
|
||||||
|
export { SearchOptions } from './commands/SEARCH';
|
Reference in New Issue
Block a user