We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04cf727 commit 8e27cc7Copy full SHA for 8e27cc7
1 file changed
src/database/drivers/FakeDriver.ts
@@ -373,6 +373,19 @@ export class FakeDriver {
373
return data
374
}
375
376
+ /**
377
+ * Find a value in database or create a new one if it doesn't exist.
378
+ */
379
+ public static async findOrCreate(data: Partial<any>): Promise<any> {
380
+ const hasValue = await this.find()
381
+
382
+ if (hasValue) {
383
+ return hasValue
384
+ }
385
386
+ return this.create(data)
387
388
389
/**
390
* Find a value in database or execute closure.
391
*/
0 commit comments