redis-om-type 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG +168 -0
- package/LICENSE +22 -0
- package/README.md +1150 -0
- package/dist/index.d.ts +1398 -0
- package/dist/index.js +2047 -0
- package/docs/.nojekyll +1 -0
- package/docs/README.md +479 -0
- package/docs/classes/AbstractSearch.md +912 -0
- package/docs/classes/ArrayHashInput.md +198 -0
- package/docs/classes/Circle.md +375 -0
- package/docs/classes/Client.md +190 -0
- package/docs/classes/Field.md +254 -0
- package/docs/classes/FieldNotInSchema.md +198 -0
- package/docs/classes/InvalidHashInput.md +213 -0
- package/docs/classes/InvalidHashValue.md +228 -0
- package/docs/classes/InvalidInput.md +207 -0
- package/docs/classes/InvalidJsonInput.md +228 -0
- package/docs/classes/InvalidJsonValue.md +228 -0
- package/docs/classes/InvalidSchema.md +197 -0
- package/docs/classes/InvalidValue.md +203 -0
- package/docs/classes/NestedHashInput.md +198 -0
- package/docs/classes/NullJsonInput.md +228 -0
- package/docs/classes/NullJsonValue.md +228 -0
- package/docs/classes/PointOutOfRange.md +203 -0
- package/docs/classes/RawSearch.md +1063 -0
- package/docs/classes/RedisOmError.md +207 -0
- package/docs/classes/Repository.md +425 -0
- package/docs/classes/Schema.md +242 -0
- package/docs/classes/Search.md +1199 -0
- package/docs/classes/SearchError.md +201 -0
- package/docs/classes/SemanticSearchError.md +197 -0
- package/docs/classes/Where.md +43 -0
- package/docs/classes/WhereField.md +915 -0
- package/logo.svg +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
[redis-om](../README.md) / RedisOmError
|
|
2
|
+
|
|
3
|
+
# Class: RedisOmError
|
|
4
|
+
|
|
5
|
+
## Hierarchy
|
|
6
|
+
|
|
7
|
+
- `Error`
|
|
8
|
+
|
|
9
|
+
↳ **`RedisOmError`**
|
|
10
|
+
|
|
11
|
+
↳↳ [`InvalidInput`](InvalidInput.md)
|
|
12
|
+
|
|
13
|
+
↳↳ [`InvalidSchema`](InvalidSchema.md)
|
|
14
|
+
|
|
15
|
+
↳↳ [`InvalidValue`](InvalidValue.md)
|
|
16
|
+
|
|
17
|
+
↳↳ [`PointOutOfRange`](PointOutOfRange.md)
|
|
18
|
+
|
|
19
|
+
↳↳ [`SearchError`](SearchError.md)
|
|
20
|
+
|
|
21
|
+
## Table of contents
|
|
22
|
+
|
|
23
|
+
### Constructors
|
|
24
|
+
|
|
25
|
+
- [constructor](RedisOmError.md#constructor)
|
|
26
|
+
|
|
27
|
+
### Properties
|
|
28
|
+
|
|
29
|
+
- [cause](RedisOmError.md#cause)
|
|
30
|
+
- [message](RedisOmError.md#message)
|
|
31
|
+
- [name](RedisOmError.md#name)
|
|
32
|
+
- [stack](RedisOmError.md#stack)
|
|
33
|
+
- [prepareStackTrace](RedisOmError.md#preparestacktrace)
|
|
34
|
+
- [stackTraceLimit](RedisOmError.md#stacktracelimit)
|
|
35
|
+
|
|
36
|
+
### Methods
|
|
37
|
+
|
|
38
|
+
- [captureStackTrace](RedisOmError.md#capturestacktrace)
|
|
39
|
+
|
|
40
|
+
## Constructors
|
|
41
|
+
|
|
42
|
+
### constructor
|
|
43
|
+
|
|
44
|
+
• **new RedisOmError**(`message?`)
|
|
45
|
+
|
|
46
|
+
#### Parameters
|
|
47
|
+
|
|
48
|
+
| Name | Type |
|
|
49
|
+
| :------ | :------ |
|
|
50
|
+
| `message?` | `string` |
|
|
51
|
+
|
|
52
|
+
#### Inherited from
|
|
53
|
+
|
|
54
|
+
Error.constructor
|
|
55
|
+
|
|
56
|
+
#### Defined in
|
|
57
|
+
|
|
58
|
+
node_modules/typescript/lib/lib.es5.d.ts:1059
|
|
59
|
+
|
|
60
|
+
• **new RedisOmError**(`message?`, `options?`)
|
|
61
|
+
|
|
62
|
+
#### Parameters
|
|
63
|
+
|
|
64
|
+
| Name | Type |
|
|
65
|
+
| :------ | :------ |
|
|
66
|
+
| `message?` | `string` |
|
|
67
|
+
| `options?` | `ErrorOptions` |
|
|
68
|
+
|
|
69
|
+
#### Inherited from
|
|
70
|
+
|
|
71
|
+
Error.constructor
|
|
72
|
+
|
|
73
|
+
#### Defined in
|
|
74
|
+
|
|
75
|
+
node_modules/typescript/lib/lib.es2022.error.d.ts:30
|
|
76
|
+
|
|
77
|
+
## Properties
|
|
78
|
+
|
|
79
|
+
### cause
|
|
80
|
+
|
|
81
|
+
• `Optional` **cause**: `unknown`
|
|
82
|
+
|
|
83
|
+
#### Inherited from
|
|
84
|
+
|
|
85
|
+
Error.cause
|
|
86
|
+
|
|
87
|
+
#### Defined in
|
|
88
|
+
|
|
89
|
+
node_modules/typescript/lib/lib.es2022.error.d.ts:26
|
|
90
|
+
|
|
91
|
+
___
|
|
92
|
+
|
|
93
|
+
### message
|
|
94
|
+
|
|
95
|
+
• **message**: `string`
|
|
96
|
+
|
|
97
|
+
#### Inherited from
|
|
98
|
+
|
|
99
|
+
Error.message
|
|
100
|
+
|
|
101
|
+
#### Defined in
|
|
102
|
+
|
|
103
|
+
node_modules/typescript/lib/lib.es5.d.ts:1054
|
|
104
|
+
|
|
105
|
+
___
|
|
106
|
+
|
|
107
|
+
### name
|
|
108
|
+
|
|
109
|
+
• **name**: `string`
|
|
110
|
+
|
|
111
|
+
#### Inherited from
|
|
112
|
+
|
|
113
|
+
Error.name
|
|
114
|
+
|
|
115
|
+
#### Defined in
|
|
116
|
+
|
|
117
|
+
node_modules/typescript/lib/lib.es5.d.ts:1053
|
|
118
|
+
|
|
119
|
+
___
|
|
120
|
+
|
|
121
|
+
### stack
|
|
122
|
+
|
|
123
|
+
• `Optional` **stack**: `string`
|
|
124
|
+
|
|
125
|
+
#### Inherited from
|
|
126
|
+
|
|
127
|
+
Error.stack
|
|
128
|
+
|
|
129
|
+
#### Defined in
|
|
130
|
+
|
|
131
|
+
node_modules/typescript/lib/lib.es5.d.ts:1055
|
|
132
|
+
|
|
133
|
+
___
|
|
134
|
+
|
|
135
|
+
### prepareStackTrace
|
|
136
|
+
|
|
137
|
+
▪ `Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any`
|
|
138
|
+
|
|
139
|
+
#### Type declaration
|
|
140
|
+
|
|
141
|
+
▸ (`err`, `stackTraces`): `any`
|
|
142
|
+
|
|
143
|
+
Optional override for formatting stack traces
|
|
144
|
+
|
|
145
|
+
**`See`**
|
|
146
|
+
|
|
147
|
+
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
148
|
+
|
|
149
|
+
##### Parameters
|
|
150
|
+
|
|
151
|
+
| Name | Type |
|
|
152
|
+
| :------ | :------ |
|
|
153
|
+
| `err` | `Error` |
|
|
154
|
+
| `stackTraces` | `CallSite`[] |
|
|
155
|
+
|
|
156
|
+
##### Returns
|
|
157
|
+
|
|
158
|
+
`any`
|
|
159
|
+
|
|
160
|
+
#### Inherited from
|
|
161
|
+
|
|
162
|
+
Error.prepareStackTrace
|
|
163
|
+
|
|
164
|
+
#### Defined in
|
|
165
|
+
|
|
166
|
+
node_modules/@types/node/globals.d.ts:11
|
|
167
|
+
|
|
168
|
+
___
|
|
169
|
+
|
|
170
|
+
### stackTraceLimit
|
|
171
|
+
|
|
172
|
+
▪ `Static` **stackTraceLimit**: `number`
|
|
173
|
+
|
|
174
|
+
#### Inherited from
|
|
175
|
+
|
|
176
|
+
Error.stackTraceLimit
|
|
177
|
+
|
|
178
|
+
#### Defined in
|
|
179
|
+
|
|
180
|
+
node_modules/@types/node/globals.d.ts:13
|
|
181
|
+
|
|
182
|
+
## Methods
|
|
183
|
+
|
|
184
|
+
### captureStackTrace
|
|
185
|
+
|
|
186
|
+
▸ `Static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
|
|
187
|
+
|
|
188
|
+
Create .stack property on a target object
|
|
189
|
+
|
|
190
|
+
#### Parameters
|
|
191
|
+
|
|
192
|
+
| Name | Type |
|
|
193
|
+
| :------ | :------ |
|
|
194
|
+
| `targetObject` | `object` |
|
|
195
|
+
| `constructorOpt?` | `Function` |
|
|
196
|
+
|
|
197
|
+
#### Returns
|
|
198
|
+
|
|
199
|
+
`void`
|
|
200
|
+
|
|
201
|
+
#### Inherited from
|
|
202
|
+
|
|
203
|
+
Error.captureStackTrace
|
|
204
|
+
|
|
205
|
+
#### Defined in
|
|
206
|
+
|
|
207
|
+
node_modules/@types/node/globals.d.ts:4
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
[redis-om](../README.md) / Repository
|
|
2
|
+
|
|
3
|
+
# Class: Repository
|
|
4
|
+
|
|
5
|
+
A repository is the main interaction point for reading, writing, and
|
|
6
|
+
removing [Entities](../README.md#entity) from Redis. Create one by calling
|
|
7
|
+
[fetchRepository](Client.md#fetchrepository) and passing in a [Schema](Schema.md). Then
|
|
8
|
+
use the [fetch](Repository.md#fetch), [save](Repository.md#save), and
|
|
9
|
+
[remove](Repository.md#remove) methods to manage your data:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
const repository = client.fetchRepository(schema)
|
|
13
|
+
|
|
14
|
+
const foo = await repository.fetch('01FK6TCJBDK41RJ766A4SBWDJ9')
|
|
15
|
+
foo.aString = 'bar'
|
|
16
|
+
foo.aBoolean = false
|
|
17
|
+
await repository.save(foo)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Use the repository to create a new instance of an [Entity](../README.md#entity)
|
|
21
|
+
before you save it:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
const foo = await repository.createEntity()
|
|
25
|
+
foo.aString = 'bar'
|
|
26
|
+
foo.aBoolean = false
|
|
27
|
+
await repository.save(foo)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If you want to use the [search](Repository.md#search) method, you need to create an index
|
|
31
|
+
first, and you need RediSearch or RedisJSON installed on your instance of Redis:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
await repository.createIndex()
|
|
35
|
+
const entities = await repository.search()
|
|
36
|
+
.where('aString').eq('bar')
|
|
37
|
+
.and('aBoolean').is.false().returnAll()
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Table of contents
|
|
41
|
+
|
|
42
|
+
### Constructors
|
|
43
|
+
|
|
44
|
+
- [constructor](Repository.md#constructor)
|
|
45
|
+
|
|
46
|
+
### Methods
|
|
47
|
+
|
|
48
|
+
- [createIndex](Repository.md#createindex)
|
|
49
|
+
- [dropIndex](Repository.md#dropindex)
|
|
50
|
+
- [expire](Repository.md#expire)
|
|
51
|
+
- [expireAt](Repository.md#expireat)
|
|
52
|
+
- [fetch](Repository.md#fetch)
|
|
53
|
+
- [remove](Repository.md#remove)
|
|
54
|
+
- [save](Repository.md#save)
|
|
55
|
+
- [search](Repository.md#search)
|
|
56
|
+
- [searchRaw](Repository.md#searchraw)
|
|
57
|
+
|
|
58
|
+
## Constructors
|
|
59
|
+
|
|
60
|
+
### constructor
|
|
61
|
+
|
|
62
|
+
• **new Repository**(`schema`, `clientOrConnection`)
|
|
63
|
+
|
|
64
|
+
Creates a new [Repository](Repository.md).
|
|
65
|
+
|
|
66
|
+
#### Parameters
|
|
67
|
+
|
|
68
|
+
| Name | Type | Description |
|
|
69
|
+
| :------ | :------ | :------ |
|
|
70
|
+
| `schema` | [`Schema`](Schema.md) | The schema defining that data in the repository. |
|
|
71
|
+
| `clientOrConnection` | [`Client`](Client.md) \| [`RedisConnection`](../README.md#redisconnection) | - |
|
|
72
|
+
|
|
73
|
+
#### Defined in
|
|
74
|
+
|
|
75
|
+
[lib/repository/repository.ts:56](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L56)
|
|
76
|
+
|
|
77
|
+
## Methods
|
|
78
|
+
|
|
79
|
+
### createIndex
|
|
80
|
+
|
|
81
|
+
▸ **createIndex**(): `Promise`<`void`\>
|
|
82
|
+
|
|
83
|
+
Creates an index in Redis for use by the [search](Repository.md#search) method.
|
|
84
|
+
Does not create a new index if the index hasn't changed. Requires that
|
|
85
|
+
RediSearch and RedisJSON are installed on your instance of Redis.
|
|
86
|
+
|
|
87
|
+
#### Returns
|
|
88
|
+
|
|
89
|
+
`Promise`<`void`\>
|
|
90
|
+
|
|
91
|
+
#### Defined in
|
|
92
|
+
|
|
93
|
+
[lib/repository/repository.ts:71](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L71)
|
|
94
|
+
|
|
95
|
+
___
|
|
96
|
+
|
|
97
|
+
### dropIndex
|
|
98
|
+
|
|
99
|
+
▸ **dropIndex**(): `Promise`<`void`\>
|
|
100
|
+
|
|
101
|
+
Removes an existing index from Redis. Use this method if you want to swap out your index
|
|
102
|
+
because your [Entity](../README.md#entity) has changed. Requires that RediSearch and RedisJSON are installed
|
|
103
|
+
on your instance of Redis.
|
|
104
|
+
|
|
105
|
+
#### Returns
|
|
106
|
+
|
|
107
|
+
`Promise`<`void`\>
|
|
108
|
+
|
|
109
|
+
#### Defined in
|
|
110
|
+
|
|
111
|
+
[lib/repository/repository.ts:109](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L109)
|
|
112
|
+
|
|
113
|
+
___
|
|
114
|
+
|
|
115
|
+
### expire
|
|
116
|
+
|
|
117
|
+
▸ **expire**(`id`, `ttlInSeconds`): `Promise`<`void`\>
|
|
118
|
+
|
|
119
|
+
Set the time to live of the [Entity](../README.md#entity). If the [Entity](../README.md#entity) is not
|
|
120
|
+
found, does nothing.
|
|
121
|
+
|
|
122
|
+
#### Parameters
|
|
123
|
+
|
|
124
|
+
| Name | Type | Description |
|
|
125
|
+
| :------ | :------ | :------ |
|
|
126
|
+
| `id` | `string` | The ID of the [Entity](../README.md#entity) to set and expiration for. |
|
|
127
|
+
| `ttlInSeconds` | `number` | The time to live in seconds. |
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`Promise`<`void`\>
|
|
132
|
+
|
|
133
|
+
#### Defined in
|
|
134
|
+
|
|
135
|
+
[lib/repository/repository.ts:242](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L242)
|
|
136
|
+
|
|
137
|
+
▸ **expire**(`ids`, `ttlInSeconds`): `Promise`<`void`\>
|
|
138
|
+
|
|
139
|
+
Set the time to live of the [Entities](../README.md#entity) in Redis with the given
|
|
140
|
+
ids. If a particular [Entity](../README.md#entity) is not found, does nothing.
|
|
141
|
+
|
|
142
|
+
#### Parameters
|
|
143
|
+
|
|
144
|
+
| Name | Type | Description |
|
|
145
|
+
| :------ | :------ | :------ |
|
|
146
|
+
| `ids` | `string`[] | The IDs of the [Entities](../README.md#entity) you wish to delete. |
|
|
147
|
+
| `ttlInSeconds` | `number` | - |
|
|
148
|
+
|
|
149
|
+
#### Returns
|
|
150
|
+
|
|
151
|
+
`Promise`<`void`\>
|
|
152
|
+
|
|
153
|
+
#### Defined in
|
|
154
|
+
|
|
155
|
+
[lib/repository/repository.ts:250](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L250)
|
|
156
|
+
|
|
157
|
+
___
|
|
158
|
+
|
|
159
|
+
### expireAt
|
|
160
|
+
|
|
161
|
+
▸ **expireAt**(`id`, `expirationDate`): `Promise`<`void`\>
|
|
162
|
+
|
|
163
|
+
Use Date object to set the [Entity](../README.md#entity)'s time to live. If the [Entity](../README.md#entity)
|
|
164
|
+
is not found, does nothing.
|
|
165
|
+
|
|
166
|
+
#### Parameters
|
|
167
|
+
|
|
168
|
+
| Name | Type | Description |
|
|
169
|
+
| :------ | :------ | :------ |
|
|
170
|
+
| `id` | `string` | The ID of the [Entity](../README.md#entity) to set an expiration date for. |
|
|
171
|
+
| `expirationDate` | `Date` | The time the data should expire. |
|
|
172
|
+
|
|
173
|
+
#### Returns
|
|
174
|
+
|
|
175
|
+
`Promise`<`void`\>
|
|
176
|
+
|
|
177
|
+
#### Defined in
|
|
178
|
+
|
|
179
|
+
[lib/repository/repository.ts:269](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L269)
|
|
180
|
+
|
|
181
|
+
▸ **expireAt**(`ids`, `expirationDate`): `Promise`<`void`\>
|
|
182
|
+
|
|
183
|
+
Use Date object to set the [Entities](../README.md#entity) in Redis with the given
|
|
184
|
+
ids. If a particular [Entity](../README.md#entity) is not found, does nothing.
|
|
185
|
+
|
|
186
|
+
#### Parameters
|
|
187
|
+
|
|
188
|
+
| Name | Type | Description |
|
|
189
|
+
| :------ | :------ | :------ |
|
|
190
|
+
| `ids` | `string`[] | The IDs of the [Entities](../README.md#entity) to set an expiration date for. |
|
|
191
|
+
| `expirationDate` | `Date` | The time the data should expire. |
|
|
192
|
+
|
|
193
|
+
#### Returns
|
|
194
|
+
|
|
195
|
+
`Promise`<`void`\>
|
|
196
|
+
|
|
197
|
+
#### Defined in
|
|
198
|
+
|
|
199
|
+
[lib/repository/repository.ts:278](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L278)
|
|
200
|
+
|
|
201
|
+
___
|
|
202
|
+
|
|
203
|
+
### fetch
|
|
204
|
+
|
|
205
|
+
▸ **fetch**(`id`): `Promise`<[`Entity`](../README.md#entity)\>
|
|
206
|
+
|
|
207
|
+
Read and return an [Entity](../README.md#entity) from Redis for the given id. If
|
|
208
|
+
the [Entity](../README.md#entity) is not found, returns an empty [Entity](../README.md#entity).
|
|
209
|
+
|
|
210
|
+
#### Parameters
|
|
211
|
+
|
|
212
|
+
| Name | Type | Description |
|
|
213
|
+
| :------ | :------ | :------ |
|
|
214
|
+
| `id` | `string` | The ID of the [Entity](../README.md#entity) you seek. |
|
|
215
|
+
|
|
216
|
+
#### Returns
|
|
217
|
+
|
|
218
|
+
`Promise`<[`Entity`](../README.md#entity)\>
|
|
219
|
+
|
|
220
|
+
The matching Entity.
|
|
221
|
+
|
|
222
|
+
#### Defined in
|
|
223
|
+
|
|
224
|
+
[lib/repository/repository.ts:171](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L171)
|
|
225
|
+
|
|
226
|
+
▸ **fetch**(`...ids`): `Promise`<[`Entity`](../README.md#entity)[]\>
|
|
227
|
+
|
|
228
|
+
Read and return the [Entities](../README.md#entity) from Redis with the given IDs. If
|
|
229
|
+
a particular [Entity](../README.md#entity) is not found, returns that [Entity](../README.md#entity) as empty.
|
|
230
|
+
|
|
231
|
+
#### Parameters
|
|
232
|
+
|
|
233
|
+
| Name | Type | Description |
|
|
234
|
+
| :------ | :------ | :------ |
|
|
235
|
+
| `...ids` | `string`[] | The IDs of the [Entities](../README.md#entity) you seek. |
|
|
236
|
+
|
|
237
|
+
#### Returns
|
|
238
|
+
|
|
239
|
+
`Promise`<[`Entity`](../README.md#entity)[]\>
|
|
240
|
+
|
|
241
|
+
The matching Entities.
|
|
242
|
+
|
|
243
|
+
#### Defined in
|
|
244
|
+
|
|
245
|
+
[lib/repository/repository.ts:180](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L180)
|
|
246
|
+
|
|
247
|
+
▸ **fetch**(`ids`): `Promise`<[`Entity`](../README.md#entity)[]\>
|
|
248
|
+
|
|
249
|
+
Read and return the [Entities](../README.md#entity) from Redis with the given IDs. If
|
|
250
|
+
a particular [Entity](../README.md#entity) is not found, returns that [Entity](../README.md#entity) as empty.
|
|
251
|
+
|
|
252
|
+
#### Parameters
|
|
253
|
+
|
|
254
|
+
| Name | Type | Description |
|
|
255
|
+
| :------ | :------ | :------ |
|
|
256
|
+
| `ids` | `string`[] | The IDs of the [Entities](../README.md#entity) you seek. |
|
|
257
|
+
|
|
258
|
+
#### Returns
|
|
259
|
+
|
|
260
|
+
`Promise`<[`Entity`](../README.md#entity)[]\>
|
|
261
|
+
|
|
262
|
+
The matching Entities.
|
|
263
|
+
|
|
264
|
+
#### Defined in
|
|
265
|
+
|
|
266
|
+
[lib/repository/repository.ts:189](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L189)
|
|
267
|
+
|
|
268
|
+
___
|
|
269
|
+
|
|
270
|
+
### remove
|
|
271
|
+
|
|
272
|
+
▸ **remove**(`id`): `Promise`<`void`\>
|
|
273
|
+
|
|
274
|
+
Remove an [Entity](../README.md#entity) from Redis for the given id. If the [Entity](../README.md#entity) is
|
|
275
|
+
not found, does nothing.
|
|
276
|
+
|
|
277
|
+
#### Parameters
|
|
278
|
+
|
|
279
|
+
| Name | Type | Description |
|
|
280
|
+
| :------ | :------ | :------ |
|
|
281
|
+
| `id` | `string` | The ID of the [Entity](../README.md#entity) you wish to delete. |
|
|
282
|
+
|
|
283
|
+
#### Returns
|
|
284
|
+
|
|
285
|
+
`Promise`<`void`\>
|
|
286
|
+
|
|
287
|
+
#### Defined in
|
|
288
|
+
|
|
289
|
+
[lib/repository/repository.ts:205](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L205)
|
|
290
|
+
|
|
291
|
+
▸ **remove**(`...ids`): `Promise`<`void`\>
|
|
292
|
+
|
|
293
|
+
Remove the [Entities](../README.md#entity) from Redis for the given ids. If a
|
|
294
|
+
particular [Entity](../README.md#entity) is not found, does nothing.
|
|
295
|
+
|
|
296
|
+
#### Parameters
|
|
297
|
+
|
|
298
|
+
| Name | Type | Description |
|
|
299
|
+
| :------ | :------ | :------ |
|
|
300
|
+
| `...ids` | `string`[] | The IDs of the [Entities](../README.md#entity) you wish to delete. |
|
|
301
|
+
|
|
302
|
+
#### Returns
|
|
303
|
+
|
|
304
|
+
`Promise`<`void`\>
|
|
305
|
+
|
|
306
|
+
#### Defined in
|
|
307
|
+
|
|
308
|
+
[lib/repository/repository.ts:213](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L213)
|
|
309
|
+
|
|
310
|
+
▸ **remove**(`ids`): `Promise`<`void`\>
|
|
311
|
+
|
|
312
|
+
Remove the [Entities](../README.md#entity) from Redis for the given ids. If a
|
|
313
|
+
particular [Entity](../README.md#entity) is not found, does nothing.
|
|
314
|
+
|
|
315
|
+
#### Parameters
|
|
316
|
+
|
|
317
|
+
| Name | Type | Description |
|
|
318
|
+
| :------ | :------ | :------ |
|
|
319
|
+
| `ids` | `string`[] | The IDs of the [Entities](../README.md#entity) you wish to delete. |
|
|
320
|
+
|
|
321
|
+
#### Returns
|
|
322
|
+
|
|
323
|
+
`Promise`<`void`\>
|
|
324
|
+
|
|
325
|
+
#### Defined in
|
|
326
|
+
|
|
327
|
+
[lib/repository/repository.ts:221](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L221)
|
|
328
|
+
|
|
329
|
+
___
|
|
330
|
+
|
|
331
|
+
### save
|
|
332
|
+
|
|
333
|
+
▸ **save**(`entity`): `Promise`<[`Entity`](../README.md#entity)\>
|
|
334
|
+
|
|
335
|
+
Insert or update an [Entity](../README.md#entity) to Redis using its entityId property
|
|
336
|
+
if present. If it's not, one is generated.
|
|
337
|
+
|
|
338
|
+
#### Parameters
|
|
339
|
+
|
|
340
|
+
| Name | Type | Description |
|
|
341
|
+
| :------ | :------ | :------ |
|
|
342
|
+
| `entity` | [`Entity`](../README.md#entity) | The Entity to save. |
|
|
343
|
+
|
|
344
|
+
#### Returns
|
|
345
|
+
|
|
346
|
+
`Promise`<[`Entity`](../README.md#entity)\>
|
|
347
|
+
|
|
348
|
+
A copy of the provided Entity with EntityId and EntityKeyName properties added.
|
|
349
|
+
|
|
350
|
+
#### Defined in
|
|
351
|
+
|
|
352
|
+
[lib/repository/repository.ts:134](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L134)
|
|
353
|
+
|
|
354
|
+
▸ **save**(`id`, `entity`): `Promise`<[`Entity`](../README.md#entity)\>
|
|
355
|
+
|
|
356
|
+
Insert or update the [Entity](../README.md#entity) to Redis using the provided entityId.
|
|
357
|
+
|
|
358
|
+
#### Parameters
|
|
359
|
+
|
|
360
|
+
| Name | Type | Description |
|
|
361
|
+
| :------ | :------ | :------ |
|
|
362
|
+
| `id` | `string` | The id to save the Entity under. |
|
|
363
|
+
| `entity` | [`Entity`](../README.md#entity) | The Entity to save. |
|
|
364
|
+
|
|
365
|
+
#### Returns
|
|
366
|
+
|
|
367
|
+
`Promise`<[`Entity`](../README.md#entity)\>
|
|
368
|
+
|
|
369
|
+
A copy of the provided Entity with EntityId and EntityKeyName properties added.
|
|
370
|
+
|
|
371
|
+
#### Defined in
|
|
372
|
+
|
|
373
|
+
[lib/repository/repository.ts:143](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L143)
|
|
374
|
+
|
|
375
|
+
___
|
|
376
|
+
|
|
377
|
+
### search
|
|
378
|
+
|
|
379
|
+
▸ **search**(): [`Search`](Search.md)
|
|
380
|
+
|
|
381
|
+
Kicks off the process of building a query. Requires that RediSearch (and optionally
|
|
382
|
+
RedisJSON) be installed on your instance of Redis.
|
|
383
|
+
|
|
384
|
+
#### Returns
|
|
385
|
+
|
|
386
|
+
[`Search`](Search.md)
|
|
387
|
+
|
|
388
|
+
A [Search](Search.md) object.
|
|
389
|
+
|
|
390
|
+
#### Defined in
|
|
391
|
+
|
|
392
|
+
[lib/repository/repository.ts:301](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L301)
|
|
393
|
+
|
|
394
|
+
___
|
|
395
|
+
|
|
396
|
+
### searchRaw
|
|
397
|
+
|
|
398
|
+
▸ **searchRaw**(`query`): [`RawSearch`](RawSearch.md)
|
|
399
|
+
|
|
400
|
+
Creates a search that bypasses Redis OM and instead allows you to execute a raw
|
|
401
|
+
RediSearch query. Requires that RediSearch (and optionally RedisJSON) be installed
|
|
402
|
+
on your instance of Redis.
|
|
403
|
+
|
|
404
|
+
Refer to https://redis.io/docs/stack/search/reference/query_syntax/ for details on
|
|
405
|
+
RediSearch query syntax.
|
|
406
|
+
|
|
407
|
+
**`Query`**
|
|
408
|
+
|
|
409
|
+
The raw RediSearch query you want to rune.
|
|
410
|
+
|
|
411
|
+
#### Parameters
|
|
412
|
+
|
|
413
|
+
| Name | Type |
|
|
414
|
+
| :------ | :------ |
|
|
415
|
+
| `query` | `string` |
|
|
416
|
+
|
|
417
|
+
#### Returns
|
|
418
|
+
|
|
419
|
+
[`RawSearch`](RawSearch.md)
|
|
420
|
+
|
|
421
|
+
A [RawSearch](RawSearch.md) object.
|
|
422
|
+
|
|
423
|
+
#### Defined in
|
|
424
|
+
|
|
425
|
+
[lib/repository/repository.ts:316](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L316)
|