Skip to content

Latest commit

 

History

History
196 lines (115 loc) · 5.81 KB

README.md

File metadata and controls

196 lines (115 loc) · 5.81 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: Object

A JavaScript object containing the underlying data of an Entity.

Index signature

▪ [key: string]: string | number | boolean | string[]

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.

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


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:21