@@ -146,14 +146,14 @@ const record = await Users.find('xxx');
146
146
Locates and returns a list of [ record] ( #record-api ) s by a drizzle where clause or an empty array if no records are found.
147
147
148
148
``` js
149
- const listOfFredRecords = await Users .findMany (like (Users .realName , ' Fred%' ));
149
+ const listOfFredRecords = await Users .findMany (like (Users .table . realName , ' Fred%' ));
150
150
```
151
151
152
152
#### findAll
153
153
Does the same thing as ` findMany ` except with an iterator so not all records are loaded into memory at the same time.
154
154
155
155
``` js
156
- const allFreds = await Users .findMany (like (Users .realName , ' Fred%' ));
156
+ const allFreds = await Users .findMany (like (Users .table . realName , ' Fred%' ));
157
157
for await (const fred of allFreds ) {
158
158
console .log (fred .get (' id' ));
159
159
}
@@ -163,7 +163,7 @@ for await (const fred of allFreds) {
163
163
Locates and returns a single [ record] ( #record-api ) by a drizzle where clause or ` undefined ` if no record is found.
164
164
165
165
``` js
166
- const fredRecord = await Users .findOne (eq (Users .username , ' Fred' ));
166
+ const fredRecord = await Users .findOne (eq (Users .table . username , ' Fred' ));
167
167
```
168
168
169
169
#### findOrDie
@@ -177,7 +177,7 @@ const record = await Users.findOrDie('xxx');
177
177
Write your own custom select function. Returns a drizzle result set, not a list of records.
178
178
179
179
``` js
180
- const results = await Users .select .where (like (Users .realName , ' Fred%' ));
180
+ const results = await Users .select .where (like (Users .table . realName , ' Fred%' ));
181
181
```
182
182
183
183
### Updating Records
@@ -187,7 +187,7 @@ Updating existing records.
187
187
Update records already in the database without first selecting them by writing your own custom query.
188
188
189
189
``` js
190
- const results = await Users .update .set ({admin: false }).where (like (Users .realName , ' Fred%' ))
190
+ const results = await Users .update .set ({admin: false }).where (like (Users .table . realName , ' Fred%' ))
191
191
```
192
192
193
193
> Note that this where clause is raw. To use it safeley you should wrap the ` like(Users.realName, 'Fred%') ` portion in the ` calcWhere() ` method below.
@@ -200,7 +200,7 @@ See also the `update()` method in the [Record API](#record-api) for updating a r
200
200
Delete records by writing your own custom query.
201
201
202
202
``` js
203
- const results = await Users .delete .where (like (Users .realName , ' Fred%' ));
203
+ const results = await Users .delete .where (like (Users .table . realName , ' Fred%' ));
204
204
```
205
205
206
206
> Note that this where clause is raw. To use it safeley you should wrap the ` like(Users.realName, 'Fred%') ` portion in the ` calcWhere() ` method below.
@@ -211,7 +211,7 @@ See also the `delete()` method in the [Record API](#record-api) for deleting a r
211
211
A safer version of ` delete ` above as it uses ` calcWhere() ` .
212
212
213
213
``` js
214
- await Users .deleteMany (like (Users .realName , ' Fred%' ));
214
+ await Users .deleteMany (like (Users .table . realName , ' Fred%' ));
215
215
```
216
216
217
217
### Utility Methods
@@ -220,14 +220,14 @@ await Users.deleteMany(like(Users.realName, 'Fred%'));
220
220
Adds ` propDefaults ` (if any) into a where clause to limit the scope of affected records. As long as you're using the built in queries you don't need to use this method. But you might want to use it if you're using ` create ` , ` select ` , ` update ` , or ` delete ` directly.
221
221
222
222
``` js
223
- const results = await Users .delete .where (Users .calcWhere (like (Users .realName , ' Fred%' )));
223
+ const results = await Users .delete .where (Users .calcWhere (like (Users .table . realName , ' Fred%' )));
224
224
```
225
225
226
226
#### count
227
227
Returns an integer representing how many records match a given where clause.
228
228
229
229
``` ts
230
- const usersNamedFred = await Users .count (like (Users .realName , ' Fred%' ));
230
+ const usersNamedFred = await Users .count (like (Users .table . realName , ' Fred%' ));
231
231
```
232
232
233
233
### Properties
0 commit comments