Skip to content

Latest commit

 

History

History
296 lines (176 loc) · 9.67 KB

README.md

File metadata and controls

296 lines (176 loc) · 9.67 KB

redis-om

redis-om

Table of contents

Classes

Interfaces

Type aliases

Type aliases

CircleFunction

Ƭ CircleFunction: (circle: Circle) => Circle

Type declaration

▸ (circle): Circle

A function that defines a circle for .inCircle searches.

Parameters
Name Type
circle Circle
Returns

Circle

Defined in

lib/search/where-point.ts:9


DataStructure

Ƭ DataStructure: "HASH" | "JSON"

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

Defined in

lib/schema/options/data-structure.ts:2


EntityConstructor

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

Type parameters

Name Description
TEntity The Entity type.

Type declaration

• (schema, id, data?)

A constructor that creates an Entity of type TEntity.

Parameters
Name Type
schema Schema<any>
id string
data? EntityData

Defined in

lib/entity/entity-constructor.ts:8


EntityData

Ƭ EntityData: Record<string, EntityValue>

A JavaScript object containing the underlying data of an Entity.

Defined in

lib/entity/entity-data.ts:6


EntityValue

Ƭ EntityValue: string | number | boolean | Point | Date | any[] | null

Valid types for properties on an Entity.

Defined in

lib/entity/entity-value.ts:6


FieldDefinition

Ƭ FieldDefinition: StringFieldDefinition | TextFieldDefinition | NumberFieldDefinition | BooleanFieldDefinition | PointFieldDefinition | DateFieldDefinition | StringArrayFieldDefinition

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

Defined in

lib/schema/definition/field-definition.ts:10


IdStrategy

Ƭ IdStrategy: () => string

Type declaration

▸ (): string

A function that generates random Entity IDs.

Returns

string

Defined in

lib/schema/options/id-strategy.ts:2


Point

Ƭ Point: Object

Defines a point on the globe using longitude and latitude.

Type declaration

Name Type Description
latitude number The latitude of the point.
longitude number The longitude of the point.

Defined in

lib/entity/point.ts:2


SchemaDefinition

Ƭ SchemaDefinition: Record<string, FieldDefinition>

Group of FieldDefinitions that define the schema for an Entity.

Defined in

lib/schema/definition/schema-definition.ts:6


SchemaFieldType

Ƭ SchemaFieldType: "string" | "number" | "boolean" | "text" | "date" | "point" | "array"

Valid types a FieldDefinition.

Defined in

lib/schema/definition/schema-field-type.ts:4


SchemaOptions

Ƭ SchemaOptions: Object

Configuration options for a Schema.

Type declaration

Name Type Description
dataStructure? DataStructure The data structure used to store the Entity in Redis. Can be set to either JSON or HASH. Defaults to JSON.
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.
indexHashName? string The name used by Redis OM to store the hash of the index for this Schema. Defaults to prefix followed by :index:hash. So, for a prefix of Foo, it would use Foo:index:hash.
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/options/schema-options.ts:9


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/options/stop-word-options.ts:2


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