File tree Expand file tree Collapse file tree 17 files changed +425
-0
lines changed Expand file tree Collapse file tree 17 files changed +425
-0
lines changed Original file line number Diff line number Diff line change @@ -1730,6 +1730,17 @@ export async function generateModelString(
1730
1730
this.hasSelect = false
1731
1731
}
1732
1732
1733
+ static select(params: (keyof ${ modelName } Type)[] | Sql): ${ modelName } Model {
1734
+ const instance = new ${ modelName } Model(null)
1735
+
1736
+ // Initialize a query with the table name and selected fields
1737
+ instance.selectFromQuery = instance.selectFromQuery.select(params)
1738
+
1739
+ instance.hasSelect = true
1740
+
1741
+ return instance
1742
+ }
1743
+
1733
1744
// Method to find a ${ modelName } by ID
1734
1745
async find(id: number): Promise<${ modelName } Model | undefined> {
1735
1746
let query = db.selectFrom('${ tableName } ').where('id', '=', id).selectAll()
@@ -2435,12 +2446,26 @@ export async function generateModelString(
2435
2446
return instance
2436
2447
}
2437
2448
2449
+ static groupBy(column: keyof ${ modelName } Type): ${ modelName } Model {
2450
+ const instance = new ${ modelName } Model(null)
2451
+
2452
+ instance.selectFromQuery = instance.selectFromQuery.orderBy(column)
2453
+
2454
+ return instance
2455
+ }
2456
+
2438
2457
orderBy(column: keyof ${ modelName } Type, order: 'asc' | 'desc'): ${ modelName } Model {
2439
2458
this.selectFromQuery = this.selectFromQuery.orderBy(column, order)
2440
2459
2441
2460
return this
2442
2461
}
2443
2462
2463
+ groupBy(column: keyof ${ modelName } Type): ${ modelName } Model {
2464
+ this.selectFromQuery = this.selectFromQuery.groupBy(column)
2465
+
2466
+ return this
2467
+ }
2468
+
2444
2469
static orderByDesc(column: keyof ${ modelName } Type): ${ modelName } Model {
2445
2470
const instance = new ${ modelName } Model(null)
2446
2471
Original file line number Diff line number Diff line change @@ -89,6 +89,17 @@ export class AccessTokenModel {
89
89
this . hasSelect = false
90
90
}
91
91
92
+ static select ( params : ( keyof AccessTokenType ) [ ] | Sql ) : AccessTokenModel {
93
+ const instance = new AccessTokenModel ( null )
94
+
95
+ // Initialize a query with the table name and selected fields
96
+ instance . selectFromQuery = instance . selectFromQuery . select ( params )
97
+
98
+ instance . hasSelect = true
99
+
100
+ return instance
101
+ }
102
+
92
103
// Method to find a AccessToken by ID
93
104
async find ( id : number ) : Promise < AccessTokenModel | undefined > {
94
105
const query = db . selectFrom ( 'personal_access_tokens' ) . where ( 'id' , '=' , id ) . selectAll ( )
@@ -792,12 +803,26 @@ export class AccessTokenModel {
792
803
return instance
793
804
}
794
805
806
+ static groupBy ( column : keyof AccessTokenType ) : AccessTokenModel {
807
+ const instance = new AccessTokenModel ( null )
808
+
809
+ instance . selectFromQuery = instance . selectFromQuery . orderBy ( column )
810
+
811
+ return instance
812
+ }
813
+
795
814
orderBy ( column : keyof AccessTokenType , order : 'asc' | 'desc' ) : AccessTokenModel {
796
815
this . selectFromQuery = this . selectFromQuery . orderBy ( column , order )
797
816
798
817
return this
799
818
}
800
819
820
+ groupBy ( column : keyof AccessTokenType ) : AccessTokenModel {
821
+ this . selectFromQuery = this . selectFromQuery . groupBy ( column )
822
+
823
+ return this
824
+ }
825
+
801
826
static orderByDesc ( column : keyof AccessTokenType ) : AccessTokenModel {
802
827
const instance = new AccessTokenModel ( null )
803
828
Original file line number Diff line number Diff line change @@ -102,6 +102,17 @@ export class DeploymentModel {
102
102
this . hasSelect = false
103
103
}
104
104
105
+ static select ( params : ( keyof DeploymentType ) [ ] | Sql ) : DeploymentModel {
106
+ const instance = new DeploymentModel ( null )
107
+
108
+ // Initialize a query with the table name and selected fields
109
+ instance . selectFromQuery = instance . selectFromQuery . select ( params )
110
+
111
+ instance . hasSelect = true
112
+
113
+ return instance
114
+ }
115
+
105
116
// Method to find a Deployment by ID
106
117
async find ( id : number ) : Promise < DeploymentModel | undefined > {
107
118
const query = db . selectFrom ( 'deployments' ) . where ( 'id' , '=' , id ) . selectAll ( )
@@ -835,12 +846,26 @@ export class DeploymentModel {
835
846
return instance
836
847
}
837
848
849
+ static groupBy ( column : keyof DeploymentType ) : DeploymentModel {
850
+ const instance = new DeploymentModel ( null )
851
+
852
+ instance . selectFromQuery = instance . selectFromQuery . orderBy ( column )
853
+
854
+ return instance
855
+ }
856
+
838
857
orderBy ( column : keyof DeploymentType , order : 'asc' | 'desc' ) : DeploymentModel {
839
858
this . selectFromQuery = this . selectFromQuery . orderBy ( column , order )
840
859
841
860
return this
842
861
}
843
862
863
+ groupBy ( column : keyof DeploymentType ) : DeploymentModel {
864
+ this . selectFromQuery = this . selectFromQuery . groupBy ( column )
865
+
866
+ return this
867
+ }
868
+
844
869
static orderByDesc ( column : keyof DeploymentType ) : DeploymentModel {
845
870
const instance = new DeploymentModel ( null )
846
871
Original file line number Diff line number Diff line change @@ -83,6 +83,17 @@ export class ErrorModel {
83
83
this . hasSelect = false
84
84
}
85
85
86
+ static select ( params : ( keyof ErrorType ) [ ] | Sql ) : ErrorModel {
87
+ const instance = new ErrorModel ( null )
88
+
89
+ // Initialize a query with the table name and selected fields
90
+ instance . selectFromQuery = instance . selectFromQuery . select ( params )
91
+
92
+ instance . hasSelect = true
93
+
94
+ return instance
95
+ }
96
+
86
97
// Method to find a Error by ID
87
98
async find ( id : number ) : Promise < ErrorModel | undefined > {
88
99
const query = db . selectFrom ( 'errors' ) . where ( 'id' , '=' , id ) . selectAll ( )
@@ -790,12 +801,26 @@ export class ErrorModel {
790
801
return instance
791
802
}
792
803
804
+ static groupBy ( column : keyof ErrorType ) : ErrorModel {
805
+ const instance = new ErrorModel ( null )
806
+
807
+ instance . selectFromQuery = instance . selectFromQuery . orderBy ( column )
808
+
809
+ return instance
810
+ }
811
+
793
812
orderBy ( column : keyof ErrorType , order : 'asc' | 'desc' ) : ErrorModel {
794
813
this . selectFromQuery = this . selectFromQuery . orderBy ( column , order )
795
814
796
815
return this
797
816
}
798
817
818
+ groupBy ( column : keyof ErrorType ) : ErrorModel {
819
+ this . selectFromQuery = this . selectFromQuery . groupBy ( column )
820
+
821
+ return this
822
+ }
823
+
799
824
static orderByDesc ( column : keyof ErrorType ) : ErrorModel {
800
825
const instance = new ErrorModel ( null )
801
826
Original file line number Diff line number Diff line change @@ -83,6 +83,17 @@ export class FailedJobModel {
83
83
this . hasSelect = false
84
84
}
85
85
86
+ static select ( params : ( keyof FailedJobType ) [ ] | Sql ) : FailedJobModel {
87
+ const instance = new FailedJobModel ( null )
88
+
89
+ // Initialize a query with the table name and selected fields
90
+ instance . selectFromQuery = instance . selectFromQuery . select ( params )
91
+
92
+ instance . hasSelect = true
93
+
94
+ return instance
95
+ }
96
+
86
97
// Method to find a FailedJob by ID
87
98
async find ( id : number ) : Promise < FailedJobModel | undefined > {
88
99
const query = db . selectFrom ( 'failed_jobs' ) . where ( 'id' , '=' , id ) . selectAll ( )
@@ -790,12 +801,26 @@ export class FailedJobModel {
790
801
return instance
791
802
}
792
803
804
+ static groupBy ( column : keyof FailedJobType ) : FailedJobModel {
805
+ const instance = new FailedJobModel ( null )
806
+
807
+ instance . selectFromQuery = instance . selectFromQuery . orderBy ( column )
808
+
809
+ return instance
810
+ }
811
+
793
812
orderBy ( column : keyof FailedJobType , order : 'asc' | 'desc' ) : FailedJobModel {
794
813
this . selectFromQuery = this . selectFromQuery . orderBy ( column , order )
795
814
796
815
return this
797
816
}
798
817
818
+ groupBy ( column : keyof FailedJobType ) : FailedJobModel {
819
+ this . selectFromQuery = this . selectFromQuery . groupBy ( column )
820
+
821
+ return this
822
+ }
823
+
799
824
static orderByDesc ( column : keyof FailedJobType ) : FailedJobModel {
800
825
const instance = new FailedJobModel ( null )
801
826
Original file line number Diff line number Diff line change @@ -83,6 +83,17 @@ export class JobModel {
83
83
this . hasSelect = false
84
84
}
85
85
86
+ static select ( params : ( keyof JobType ) [ ] | Sql ) : JobModel {
87
+ const instance = new JobModel ( null )
88
+
89
+ // Initialize a query with the table name and selected fields
90
+ instance . selectFromQuery = instance . selectFromQuery . select ( params )
91
+
92
+ instance . hasSelect = true
93
+
94
+ return instance
95
+ }
96
+
86
97
// Method to find a Job by ID
87
98
async find ( id : number ) : Promise < JobModel | undefined > {
88
99
const query = db . selectFrom ( 'jobs' ) . where ( 'id' , '=' , id ) . selectAll ( )
@@ -790,12 +801,26 @@ export class JobModel {
790
801
return instance
791
802
}
792
803
804
+ static groupBy ( column : keyof JobType ) : JobModel {
805
+ const instance = new JobModel ( null )
806
+
807
+ instance . selectFromQuery = instance . selectFromQuery . orderBy ( column )
808
+
809
+ return instance
810
+ }
811
+
793
812
orderBy ( column : keyof JobType , order : 'asc' | 'desc' ) : JobModel {
794
813
this . selectFromQuery = this . selectFromQuery . orderBy ( column , order )
795
814
796
815
return this
797
816
}
798
817
818
+ groupBy ( column : keyof JobType ) : JobModel {
819
+ this . selectFromQuery = this . selectFromQuery . groupBy ( column )
820
+
821
+ return this
822
+ }
823
+
799
824
static orderByDesc ( column : keyof JobType ) : JobModel {
800
825
const instance = new JobModel ( null )
801
826
Original file line number Diff line number Diff line change @@ -108,6 +108,17 @@ export class PaymentMethodModel {
108
108
this . hasSelect = false
109
109
}
110
110
111
+ static select ( params : ( keyof PaymentMethodType ) [ ] | Sql ) : PaymentMethodModel {
112
+ const instance = new PaymentMethodModel ( null )
113
+
114
+ // Initialize a query with the table name and selected fields
115
+ instance . selectFromQuery = instance . selectFromQuery . select ( params )
116
+
117
+ instance . hasSelect = true
118
+
119
+ return instance
120
+ }
121
+
111
122
// Method to find a PaymentMethod by ID
112
123
async find ( id : number ) : Promise < PaymentMethodModel | undefined > {
113
124
const query = db . selectFrom ( 'payment_methods' ) . where ( 'id' , '=' , id ) . selectAll ( )
@@ -845,12 +856,26 @@ export class PaymentMethodModel {
845
856
return instance
846
857
}
847
858
859
+ static groupBy ( column : keyof PaymentMethodType ) : PaymentMethodModel {
860
+ const instance = new PaymentMethodModel ( null )
861
+
862
+ instance . selectFromQuery = instance . selectFromQuery . orderBy ( column )
863
+
864
+ return instance
865
+ }
866
+
848
867
orderBy ( column : keyof PaymentMethodType , order : 'asc' | 'desc' ) : PaymentMethodModel {
849
868
this . selectFromQuery = this . selectFromQuery . orderBy ( column , order )
850
869
851
870
return this
852
871
}
853
872
873
+ groupBy ( column : keyof PaymentMethodType ) : PaymentMethodModel {
874
+ this . selectFromQuery = this . selectFromQuery . groupBy ( column )
875
+
876
+ return this
877
+ }
878
+
854
879
static orderByDesc ( column : keyof PaymentMethodType ) : PaymentMethodModel {
855
880
const instance = new PaymentMethodModel ( null )
856
881
Original file line number Diff line number Diff line change @@ -83,6 +83,17 @@ export class PostModel {
83
83
this . hasSelect = false
84
84
}
85
85
86
+ static select ( params : ( keyof PostType ) [ ] | Sql ) : PostModel {
87
+ const instance = new PostModel ( null )
88
+
89
+ // Initialize a query with the table name and selected fields
90
+ instance . selectFromQuery = instance . selectFromQuery . select ( params )
91
+
92
+ instance . hasSelect = true
93
+
94
+ return instance
95
+ }
96
+
86
97
// Method to find a Post by ID
87
98
async find ( id : number ) : Promise < PostModel | undefined > {
88
99
const query = db . selectFrom ( 'posts' ) . where ( 'id' , '=' , id ) . selectAll ( )
@@ -770,12 +781,26 @@ export class PostModel {
770
781
return instance
771
782
}
772
783
784
+ static groupBy ( column : keyof PostType ) : PostModel {
785
+ const instance = new PostModel ( null )
786
+
787
+ instance . selectFromQuery = instance . selectFromQuery . orderBy ( column )
788
+
789
+ return instance
790
+ }
791
+
773
792
orderBy ( column : keyof PostType , order : 'asc' | 'desc' ) : PostModel {
774
793
this . selectFromQuery = this . selectFromQuery . orderBy ( column , order )
775
794
776
795
return this
777
796
}
778
797
798
+ groupBy ( column : keyof PostType ) : PostModel {
799
+ this . selectFromQuery = this . selectFromQuery . groupBy ( column )
800
+
801
+ return this
802
+ }
803
+
779
804
static orderByDesc ( column : keyof PostType ) : PostModel {
780
805
const instance = new PostModel ( null )
781
806
You can’t perform that action at this time.
0 commit comments