File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed
storage/framework/core/orm/src/generated Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -505,6 +505,14 @@ async function findByEmail(email: string) {
505
505
. executeTakeFirst ( )
506
506
}
507
507
508
+ async function findByName ( name : string ) {
509
+ return await db
510
+ . selectFrom ( 'users' )
511
+ . where ( 'name' , '=' , name )
512
+ . selectAll ( )
513
+ . executeTakeFirst ( )
514
+ }
515
+
508
516
async function where (
509
517
criteria : Partial < UserType > ,
510
518
options : QueryOptions = { } ,
@@ -547,6 +555,26 @@ async function where(
547
555
return await query . selectAll ( ) . execute ( )
548
556
}
549
557
558
+ async function whereEmail ( email : string ) {
559
+ return db . selectFrom ( 'users' )
560
+ . where ( 'email' , '=' , email )
561
+ . selectAll ( )
562
+ . execute ( )
563
+
564
+ // .executeTakeFirst()
565
+
566
+ // if (!user) return null
567
+
568
+ // return new UserModel(user)
569
+ }
570
+
571
+ async function whereName ( name : string ) {
572
+ return db . selectFrom ( 'users' )
573
+ . where ( 'name' , '=' , name )
574
+ . selectAll ( )
575
+ . execute ( )
576
+ }
577
+
550
578
async function whereIn (
551
579
column : keyof UserType ,
552
580
values : any [ ] ,
@@ -598,6 +626,8 @@ async function recent(number: number, options: QueryOptions = {}) {
598
626
return await query . execute ( )
599
627
}
600
628
629
+ const model = Model
630
+
601
631
export const User = {
602
632
find,
603
633
findMany,
@@ -607,10 +637,13 @@ export const User = {
607
637
update,
608
638
remove,
609
639
findByEmail,
610
- Model,
640
+ findByName,
641
+ model,
611
642
first,
612
643
last,
613
644
where,
645
+ whereEmail,
646
+ whereName,
614
647
whereIn,
615
648
count,
616
649
recent,
You can’t perform that action at this time.
0 commit comments