pqb 0.40.2 → 0.40.3
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/dist/index.d.ts +24 -14
- package/dist/index.js +15 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -11157,7 +11157,7 @@ class QueryUpsertOrCreate {
|
|
|
11157
11157
|
*
|
|
11158
11158
|
* ```ts
|
|
11159
11159
|
* await User.selectAll()
|
|
11160
|
-
* .
|
|
11160
|
+
* .findBy({ email: 'some@email.com' })
|
|
11161
11161
|
* .upsert({
|
|
11162
11162
|
* data: {
|
|
11163
11163
|
* // update record's name
|
|
@@ -11171,7 +11171,7 @@ class QueryUpsertOrCreate {
|
|
|
11171
11171
|
*
|
|
11172
11172
|
* // the same as above but using `update` and `create`
|
|
11173
11173
|
* await User.selectAll()
|
|
11174
|
-
* .
|
|
11174
|
+
* .findBy({ email: 'some@email.com' })
|
|
11175
11175
|
* .upsert({
|
|
11176
11176
|
* update: {
|
|
11177
11177
|
* name: 'updated user',
|
|
@@ -11188,7 +11188,7 @@ class QueryUpsertOrCreate {
|
|
|
11188
11188
|
*
|
|
11189
11189
|
* ```ts
|
|
11190
11190
|
* await User.selectAll()
|
|
11191
|
-
* .
|
|
11191
|
+
* .findBy({ email: 'some@email.com' })
|
|
11192
11192
|
* .upsert({
|
|
11193
11193
|
* update: {
|
|
11194
11194
|
* name: 'updated user',
|
|
@@ -11201,7 +11201,7 @@ class QueryUpsertOrCreate {
|
|
|
11201
11201
|
*
|
|
11202
11202
|
* // the same as above using `data`
|
|
11203
11203
|
* await User.selectAll()
|
|
11204
|
-
* .
|
|
11204
|
+
* .findBy({ email: 'some@email.com' })
|
|
11205
11205
|
* .upsert({
|
|
11206
11206
|
* data: {
|
|
11207
11207
|
* name: 'updated user',
|
|
@@ -11218,7 +11218,7 @@ class QueryUpsertOrCreate {
|
|
|
11218
11218
|
*
|
|
11219
11219
|
* ```ts
|
|
11220
11220
|
* const user = await User.selectAll()
|
|
11221
|
-
* .
|
|
11221
|
+
* .findBy({ email: 'some@email.com' })
|
|
11222
11222
|
* .upsert({
|
|
11223
11223
|
* data: {
|
|
11224
11224
|
* name: 'updated user',
|
|
@@ -11258,17 +11258,19 @@ class QueryUpsertOrCreate {
|
|
|
11258
11258
|
* By default, it is not returning columns, place `get`, `select`, or `selectAll` before `orCreate` to specify returning columns.
|
|
11259
11259
|
*
|
|
11260
11260
|
* ```ts
|
|
11261
|
-
* const user = await User.selectAll()
|
|
11262
|
-
* email: 'some@email.com'
|
|
11263
|
-
*
|
|
11264
|
-
*
|
|
11261
|
+
* const user = await User.selectAll()
|
|
11262
|
+
* .findBy({ email: 'some@email.com' })
|
|
11263
|
+
* .orCreate({
|
|
11264
|
+
* email: 'some@email.com',
|
|
11265
|
+
* name: 'created user',
|
|
11266
|
+
* });
|
|
11265
11267
|
* ```
|
|
11266
11268
|
*
|
|
11267
11269
|
* The data may be returned from a function, it won't be called if the record was found:
|
|
11268
11270
|
*
|
|
11269
11271
|
* ```ts
|
|
11270
11272
|
* const user = await User.selectAll()
|
|
11271
|
-
* .
|
|
11273
|
+
* .findBy({ email: 'some@email.com' })
|
|
11272
11274
|
* .orCreate(() => ({
|
|
11273
11275
|
* email: 'some@email.com',
|
|
11274
11276
|
* name: 'created user',
|
|
@@ -11369,11 +11371,11 @@ class QueryMap {
|
|
|
11369
11371
|
/**
|
|
11370
11372
|
* Use `map` to transform individual records of a query result.
|
|
11371
11373
|
*
|
|
11372
|
-
*
|
|
11374
|
+
* Use `map` to transform individual records of a query result. If the query returns multiple, `map` function going to transform records one by one.
|
|
11373
11375
|
*
|
|
11374
|
-
* For
|
|
11376
|
+
* For an optional query result (`findOptional`, `getOptional`, etc.), `map` is **not** called for empty results.
|
|
11375
11377
|
*
|
|
11376
|
-
*
|
|
11378
|
+
* For transforming the result of a query as a whole, consider using {@link Query.transform} instead.
|
|
11377
11379
|
*
|
|
11378
11380
|
* ```ts
|
|
11379
11381
|
* // add a `titleLength` to every post
|