Skip to content

Latest commit

 

History

History
207 lines (122 loc) · 6.55 KB

README.md

File metadata and controls

207 lines (122 loc) · 6.55 KB

redis-om

redis-om

Table of contents

Classes

Interfaces

Type aliases

Type aliases

EntityConstructor

Ƭ EntityConstructor<TEntity>: (id: string, data?: EntityData) => TEntity

Type parameters

Name Description
TEntity The Entity type.

Type declaration

• (id, data?)

A constructor that creates an Entity of type TEntity.

Parameters
Name Type
id string
data? EntityData

Defined in

lib/entity/entity.ts:10


EntityData

Ƭ EntityData: Record<string, number | boolean | string | string[]>

A JavaScript object containing the underlying data of an Entity.

Defined in

lib/entity/entity.ts:4


FieldDefinition

Ƭ FieldDefinition: NumericField | StringField | BooleanField | ArrayField

Contains instructions telling how to map a property on an Entity to Redis.

Defined in

lib/schema/schema-definitions.ts:54


IdStrategy

Ƭ IdStrategy: () => string

Type declaration

▸ (): string

A function that generates random Entity IDs.

Returns

string

Defined in

lib/schema/schema-definitions.ts:68


SchemaDefinition

Ƭ SchemaDefinition: Object

Group of FieldDefinitions that define the schema for an Entity.

Index signature

▪ [key: string]: FieldDefinition

The key determines the propery name that is added to the Entity. The property contains a FieldDefinition that tell Redis OM how to map the property to Redis.

Defined in

lib/schema/schema-definitions.ts:59


SchemaOptions

Ƭ SchemaOptions: Object

Configuration options for a Schema.

Type declaration

Name Type Description
dataStructure? SearchDataStructure The data structure used to store the Entity in Redis.
idStrategy? IdStrategy A function that generates a random Entity ID. Defaults to a function that generates ULIDs. Combined with prefix to generate a Redis key. If prefix is Foo and idStratgey returns 12345 then the generated key would be Foo:12345.
indexName? string The name used by RediSearch to store the index for this Schema. Defaults to prefix followed by :index. So, for a prefix of Foo, it would use Foo:index.
prefix? string The string that comes before the ID when creating Redis keys for Entities. Defaults to the class name of the Entity. Combined with the results of idStrategy to generate a key. If prefix is Foo and idStrategy returns 12345 then the generated key would be Foo:12345.
stopWords? string[] Stop words to be used by this schema. If useStopWords is anything other than CUSTOM, this option is ignored.
useStopWords? StopWordOptions Configures the usage of stop words. Valid values are OFF, DEFAULT, and CUSTOM. Setting this to OFF disables all stop words. Setting this to DEFAULT uses the stop words intrinsic to RediSearch. Setting this to CUSTOM tells RediSearch to use the stop words in stopWords.

Defined in

lib/schema/schema-options.ts:7


SearchDataStructure

Ƭ SearchDataStructure: "HASH" | "JSON"

The type of data structure in Redis to map objects to.

Defined in

lib/client.ts:21


StopWordOptions

Ƭ StopWordOptions: "OFF" | "DEFAULT" | "CUSTOM"

Valid values for how to use stop words for a given Schema.

Defined in

lib/schema/schema-definitions.ts:71


SubSearchFunction

Ƭ SubSearchFunction<TEntity>: (search: Search<TEntity>) => Search<TEntity>

Type parameters

Name Type Description
TEntity extends Entity The type of Entity being sought.

Type declaration

▸ (search): Search<TEntity>

A function that takes a Search and returns a Search. Used in nested queries.

Parameters
Name Type
search Search<TEntity>
Returns

Search<TEntity>

Defined in

lib/search/search.ts:22