Skip to content

Commit ef0a7e7

Browse files
committed
fixed: Documentation: useVingRecord findOne docs are wrong #201
1 parent 6df32d2 commit ef0a7e7

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

ving/docs/change-log.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ outline: deep
77

88
### 2025-01-12
99
* Removed pulumi from the project.
10+
* Fixed: Documentation: useVingRecord findOne docs are wrong #201
1011

1112
## December 2024
1213

ving/docs/subsystems/ving-record.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ const record = await Users.find('xxx');
146146
Locates and returns a list of [record](#record-api)s by a drizzle where clause or an empty array if no records are found.
147147

148148
```js
149-
const listOfFredRecords = await Users.findMany(like(Users.realName, 'Fred%'));
149+
const listOfFredRecords = await Users.findMany(like(Users.table.realName, 'Fred%'));
150150
```
151151

152152
#### findAll
153153
Does the same thing as `findMany` except with an iterator so not all records are loaded into memory at the same time.
154154

155155
```js
156-
const allFreds = await Users.findMany(like(Users.realName, 'Fred%'));
156+
const allFreds = await Users.findMany(like(Users.table.realName, 'Fred%'));
157157
for await (const fred of allFreds) {
158158
console.log(fred.get('id'));
159159
}
@@ -163,7 +163,7 @@ for await (const fred of allFreds) {
163163
Locates and returns a single [record](#record-api) by a drizzle where clause or `undefined` if no record is found.
164164

165165
```js
166-
const fredRecord = await Users.findOne(eq(Users.username, 'Fred'));
166+
const fredRecord = await Users.findOne(eq(Users.table.username, 'Fred'));
167167
```
168168

169169
#### findOrDie
@@ -177,7 +177,7 @@ const record = await Users.findOrDie('xxx');
177177
Write your own custom select function. Returns a drizzle result set, not a list of records.
178178

179179
```js
180-
const results = await Users.select.where(like(Users.realName, 'Fred%'));
180+
const results = await Users.select.where(like(Users.table.realName, 'Fred%'));
181181
```
182182

183183
### Updating Records
@@ -187,7 +187,7 @@ Updating existing records.
187187
Update records already in the database without first selecting them by writing your own custom query.
188188

189189
```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%'))
191191
```
192192

193193
> 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
200200
Delete records by writing your own custom query.
201201

202202
```js
203-
const results = await Users.delete.where(like(Users.realName, 'Fred%'));
203+
const results = await Users.delete.where(like(Users.table.realName, 'Fred%'));
204204
```
205205

206206
> 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
211211
A safer version of `delete` above as it uses `calcWhere()`.
212212

213213
```js
214-
await Users.deleteMany(like(Users.realName, 'Fred%'));
214+
await Users.deleteMany(like(Users.table.realName, 'Fred%'));
215215
```
216216

217217
### Utility Methods
@@ -220,14 +220,14 @@ await Users.deleteMany(like(Users.realName, 'Fred%'));
220220
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.
221221

222222
```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%')));
224224
```
225225

226226
#### count
227227
Returns an integer representing how many records match a given where clause.
228228

229229
```ts
230-
const usersNamedFred = await Users.count(like(Users.realName, 'Fred%'));
230+
const usersNamedFred = await Users.count(like(Users.table.realName, 'Fred%'));
231231
```
232232

233233
### Properties

0 commit comments

Comments
 (0)