hysteria-orm 10.5.8 → 10.6.0
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/lib/cli.js +19 -19
- package/lib/cli.js.map +1 -1
- package/lib/index.cjs +13 -13
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +119 -73
- package/lib/index.d.ts +119 -73
- package/lib/index.js +13 -13
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ interface SqliteDataSourceInput extends CommonDataSourceInput {
|
|
|
117
117
|
* @description The filename of the database file for SQLite
|
|
118
118
|
* @default ":memory:"
|
|
119
119
|
*/
|
|
120
|
-
readonly database?: string;
|
|
120
|
+
readonly database?: ":memory:" | (string & {});
|
|
121
121
|
}
|
|
122
122
|
interface NotNullableSqliteDataSourceInput extends SqliteDataSourceInput {
|
|
123
123
|
readonly type?: "sqlite";
|
|
@@ -876,6 +876,24 @@ type OracledbTableOptions = {
|
|
|
876
876
|
inMemory?: boolean;
|
|
877
877
|
compressFor?: "QUERY LOW" | "QUERY HIGH" | "ARCHIVE LOW" | "ARCHIVE HIGH";
|
|
878
878
|
};
|
|
879
|
+
type DateTimeOptions = {
|
|
880
|
+
/**
|
|
881
|
+
* @description Whether to include the timezone in the datetime column
|
|
882
|
+
*/
|
|
883
|
+
withTimezone?: boolean;
|
|
884
|
+
/**
|
|
885
|
+
* @description The precision of the datetime column
|
|
886
|
+
*/
|
|
887
|
+
precision?: number;
|
|
888
|
+
/**
|
|
889
|
+
* @description Sets DEFAULT CURRENT_TIMESTAMP on the column
|
|
890
|
+
*/
|
|
891
|
+
autoCreate?: boolean;
|
|
892
|
+
/**
|
|
893
|
+
* @description Automatically updates the column on row update. Uses ON UPDATE CURRENT_TIMESTAMP on MySQL/MariaDB, auto-generates a trigger on other databases
|
|
894
|
+
*/
|
|
895
|
+
autoUpdate?: boolean;
|
|
896
|
+
};
|
|
879
897
|
/**
|
|
880
898
|
* @description Union type for all database-specific table options
|
|
881
899
|
*/
|
|
@@ -1517,6 +1535,8 @@ declare class ColumnTypeNode extends QueryNode {
|
|
|
1517
1535
|
enumValues?: readonly string[];
|
|
1518
1536
|
autoIncrement?: boolean;
|
|
1519
1537
|
withTimezone?: boolean;
|
|
1538
|
+
autoCreate?: boolean;
|
|
1539
|
+
autoUpdate?: boolean;
|
|
1520
1540
|
collate?: string;
|
|
1521
1541
|
chainsWith: string;
|
|
1522
1542
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
@@ -1530,6 +1550,8 @@ declare class ColumnTypeNode extends QueryNode {
|
|
|
1530
1550
|
enumValues?: readonly string[];
|
|
1531
1551
|
withTimezone?: boolean;
|
|
1532
1552
|
autoIncrement?: boolean;
|
|
1553
|
+
autoCreate?: boolean;
|
|
1554
|
+
autoUpdate?: boolean;
|
|
1533
1555
|
collate?: string;
|
|
1534
1556
|
isRawValue?: boolean;
|
|
1535
1557
|
});
|
|
@@ -1791,21 +1813,19 @@ declare class CreateTableBuilder extends BaseBuilder {
|
|
|
1791
1813
|
* @mysql DATETIME(precision)
|
|
1792
1814
|
* @postgres TIMESTAMP(precision) WITHOUT TIME ZONE
|
|
1793
1815
|
* @sqlite TEXT
|
|
1816
|
+
* @param options.autoCreate Sets DEFAULT CURRENT_TIMESTAMP on the column
|
|
1817
|
+
* @param options.autoUpdate Automatically updates the column on row update. Uses ON UPDATE CURRENT_TIMESTAMP on MySQL/MariaDB, auto-generates a trigger on other databases
|
|
1794
1818
|
*/
|
|
1795
|
-
datetime(name: string, options?:
|
|
1796
|
-
withTimezone?: boolean;
|
|
1797
|
-
precision?: number;
|
|
1798
|
-
}): ConstraintBuilder;
|
|
1819
|
+
datetime(name: string, options?: DateTimeOptions): ConstraintBuilder;
|
|
1799
1820
|
/**
|
|
1800
1821
|
* Timestamp type
|
|
1801
1822
|
* @mysql TIMESTAMP(precision)
|
|
1802
1823
|
* @postgres TIMESTAMP(precision) WITH/WITHOUT TIME ZONE
|
|
1803
1824
|
* @sqlite TEXT
|
|
1825
|
+
* @param options.autoCreate Sets DEFAULT CURRENT_TIMESTAMP on the column
|
|
1826
|
+
* @param options.autoUpdate Automatically updates the column on row update. Uses ON UPDATE CURRENT_TIMESTAMP on MySQL/MariaDB, auto-generates a trigger on other databases
|
|
1804
1827
|
*/
|
|
1805
|
-
timestamp(name: string, options?:
|
|
1806
|
-
withTimezone?: boolean;
|
|
1807
|
-
precision?: number;
|
|
1808
|
-
}): ConstraintBuilder;
|
|
1828
|
+
timestamp(name: string, options?: DateTimeOptions): ConstraintBuilder;
|
|
1809
1829
|
/**
|
|
1810
1830
|
* Boolean type
|
|
1811
1831
|
* @mysql BOOLEAN
|
|
@@ -3760,84 +3780,90 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
3760
3780
|
/**
|
|
3761
3781
|
* @description Adds a WHERE condition to the query.
|
|
3762
3782
|
*/
|
|
3763
|
-
where(column: ModelKey<T>, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3764
|
-
where<S extends string>(column: SelectableColumn$1<S>, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3765
3783
|
where(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
|
|
3766
|
-
where(column:
|
|
3767
|
-
where(column:
|
|
3768
|
-
where
|
|
3784
|
+
where(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3785
|
+
where(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3786
|
+
where<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType, value: WhereColumnValue<T, K>): this;
|
|
3787
|
+
where<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
|
|
3788
|
+
where(column: `${string}.${string}`, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3789
|
+
where(column: `${string}.${string}`, value: BaseValues): this;
|
|
3769
3790
|
/**
|
|
3770
3791
|
* @description Adds an AND WHERE condition to the query.
|
|
3771
3792
|
*/
|
|
3772
|
-
andWhere(column: ModelKey<T>, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3773
|
-
andWhere(column: SelectableColumn$1<string>, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3774
|
-
andWhere(column: ModelKey<T> | SelectableColumn$1<string>, value: BaseValues): this;
|
|
3775
3793
|
andWhere(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
|
|
3776
|
-
andWhere(column:
|
|
3777
|
-
andWhere(column:
|
|
3794
|
+
andWhere(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3795
|
+
andWhere(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3796
|
+
andWhere<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType, value: WhereColumnValue<T, K>): this;
|
|
3797
|
+
andWhere<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
|
|
3798
|
+
andWhere(column: `${string}.${string}`, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3799
|
+
andWhere(column: `${string}.${string}`, value: BaseValues): this;
|
|
3778
3800
|
/**
|
|
3779
3801
|
* @description Adds an OR WHERE condition to the query.
|
|
3780
3802
|
*/
|
|
3781
|
-
orWhere(column: ModelKey<T>, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3782
|
-
orWhere<S extends string>(column: SelectableColumn$1<S>, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3783
|
-
orWhere<S extends string>(column: ModelKey<T> | SelectableColumn$1<S>, value: BaseValues): this;
|
|
3784
3803
|
orWhere(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
|
|
3785
|
-
orWhere(column:
|
|
3786
|
-
orWhere(column:
|
|
3804
|
+
orWhere(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3805
|
+
orWhere(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3806
|
+
orWhere<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType, value: WhereColumnValue<T, K>): this;
|
|
3807
|
+
orWhere<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
|
|
3808
|
+
orWhere(column: `${string}.${string}`, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3809
|
+
orWhere(column: `${string}.${string}`, value: BaseValues): this;
|
|
3787
3810
|
/**
|
|
3788
3811
|
* @description Adds a negated WHERE condition to the query.
|
|
3789
3812
|
*/
|
|
3790
|
-
whereNot(column:
|
|
3791
|
-
whereNot
|
|
3792
|
-
whereNot
|
|
3793
|
-
whereNot
|
|
3794
|
-
whereNot(column:
|
|
3813
|
+
whereNot(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3814
|
+
whereNot(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3815
|
+
whereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType, value: WhereColumnValue<T, K>): this;
|
|
3816
|
+
whereNot<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
|
|
3817
|
+
whereNot(column: `${string}.${string}`, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3818
|
+
whereNot(column: `${string}.${string}`, value: BaseValues): this;
|
|
3795
3819
|
/**
|
|
3796
3820
|
* @description Adds a negated AND WHERE condition to the query.
|
|
3797
3821
|
*/
|
|
3798
|
-
andWhereNot(column:
|
|
3799
|
-
andWhereNot
|
|
3800
|
-
andWhereNot
|
|
3801
|
-
andWhereNot
|
|
3802
|
-
andWhereNot(column:
|
|
3822
|
+
andWhereNot(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3823
|
+
andWhereNot(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3824
|
+
andWhereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType, value: WhereColumnValue<T, K>): this;
|
|
3825
|
+
andWhereNot<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
|
|
3826
|
+
andWhereNot(column: `${string}.${string}`, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3827
|
+
andWhereNot(column: `${string}.${string}`, value: BaseValues): this;
|
|
3803
3828
|
/**
|
|
3804
3829
|
* @description Adds a negated OR WHERE condition to the query.
|
|
3805
3830
|
*/
|
|
3806
|
-
orWhereNot(column:
|
|
3807
|
-
orWhereNot
|
|
3808
|
-
orWhereNot
|
|
3809
|
-
orWhereNot
|
|
3810
|
-
orWhereNot(column:
|
|
3831
|
+
orWhereNot(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3832
|
+
orWhereNot(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3833
|
+
orWhereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType, value: WhereColumnValue<T, K>): this;
|
|
3834
|
+
orWhereNot<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
|
|
3835
|
+
orWhereNot(column: `${string}.${string}`, operator: BinaryOperatorType, value: BaseValues): this;
|
|
3836
|
+
orWhereNot(column: `${string}.${string}`, value: BaseValues): this;
|
|
3811
3837
|
/**
|
|
3812
3838
|
* @description Adds a WHERE BETWEEN condition to the query.
|
|
3813
3839
|
*/
|
|
3814
|
-
whereBetween
|
|
3815
|
-
whereBetween
|
|
3840
|
+
whereBetween<K extends ModelKey<T>>(column: K, min: T[K], max: T[K]): this;
|
|
3841
|
+
whereBetween(column: `${string}.${string}`, min: BaseValues, max: BaseValues): this;
|
|
3816
3842
|
/**
|
|
3817
3843
|
* @description Adds an AND WHERE BETWEEN condition to the query.
|
|
3818
3844
|
*/
|
|
3819
|
-
andWhereBetween
|
|
3820
|
-
andWhereBetween
|
|
3845
|
+
andWhereBetween<K extends ModelKey<T>>(column: K, min: T[K], max: T[K]): this;
|
|
3846
|
+
andWhereBetween(column: `${string}.${string}`, min: BaseValues, max: BaseValues): this;
|
|
3821
3847
|
/**
|
|
3822
3848
|
* @description Adds an OR WHERE BETWEEN condition to the query.
|
|
3823
3849
|
*/
|
|
3824
|
-
orWhereBetween
|
|
3825
|
-
orWhereBetween
|
|
3850
|
+
orWhereBetween<K extends ModelKey<T>>(column: K, min: T[K], max: T[K]): this;
|
|
3851
|
+
orWhereBetween(column: `${string}.${string}`, min: BaseValues, max: BaseValues): this;
|
|
3826
3852
|
/**
|
|
3827
3853
|
* @description Adds a WHERE NOT BETWEEN condition to the query.
|
|
3828
3854
|
*/
|
|
3829
|
-
whereNotBetween
|
|
3830
|
-
whereNotBetween
|
|
3855
|
+
whereNotBetween<K extends ModelKey<T>>(column: K, min: T[K], max: T[K]): this;
|
|
3856
|
+
whereNotBetween(column: `${string}.${string}`, min: BaseValues, max: BaseValues): this;
|
|
3831
3857
|
/**
|
|
3832
3858
|
* @description Adds an AND WHERE NOT BETWEEN condition to the query.
|
|
3833
3859
|
*/
|
|
3834
|
-
andWhereNotBetween
|
|
3835
|
-
andWhereNotBetween
|
|
3860
|
+
andWhereNotBetween<K extends ModelKey<T>>(column: K, min: T[K], max: T[K]): this;
|
|
3861
|
+
andWhereNotBetween(column: `${string}.${string}`, min: BaseValues, max: BaseValues): this;
|
|
3836
3862
|
/**
|
|
3837
3863
|
* @description Adds an OR WHERE NOT BETWEEN condition to the query.
|
|
3838
3864
|
*/
|
|
3839
|
-
orWhereNotBetween
|
|
3840
|
-
orWhereNotBetween
|
|
3865
|
+
orWhereNotBetween<K extends ModelKey<T>>(column: K, min: T[K], max: T[K]): this;
|
|
3866
|
+
orWhereNotBetween(column: `${string}.${string}`, min: BaseValues, max: BaseValues): this;
|
|
3841
3867
|
/**
|
|
3842
3868
|
* @description Adds a WHERE LIKE condition to the query.
|
|
3843
3869
|
*/
|
|
@@ -3902,38 +3928,44 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
3902
3928
|
* @description Adds a WHERE IN condition to the query.
|
|
3903
3929
|
* @warning If the array is empty, it will add an impossible condition.
|
|
3904
3930
|
*/
|
|
3905
|
-
whereIn(column:
|
|
3906
|
-
whereIn<
|
|
3931
|
+
whereIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3932
|
+
whereIn<K extends ModelKey<T>>(column: K, values: T[K][]): this;
|
|
3933
|
+
whereIn(column: `${string}.${string}`, values: BaseValues[]): this;
|
|
3907
3934
|
/**
|
|
3908
3935
|
* @description Adds an AND WHERE IN condition to the query.
|
|
3909
3936
|
* @warning If the array is empty, it will add an impossible condition.
|
|
3910
3937
|
*/
|
|
3911
|
-
andWhereIn(column:
|
|
3912
|
-
andWhereIn<
|
|
3938
|
+
andWhereIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3939
|
+
andWhereIn<K extends ModelKey<T>>(column: K, values: T[K][]): this;
|
|
3940
|
+
andWhereIn(column: `${string}.${string}`, values: BaseValues[]): this;
|
|
3913
3941
|
/**
|
|
3914
3942
|
* @description Adds an OR WHERE IN condition to the query.
|
|
3915
3943
|
* @warning If the array is empty, it will add an impossible condition.
|
|
3916
3944
|
*/
|
|
3917
|
-
orWhereIn(column:
|
|
3918
|
-
orWhereIn<
|
|
3945
|
+
orWhereIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3946
|
+
orWhereIn<K extends ModelKey<T>>(column: K, values: T[K][]): this;
|
|
3947
|
+
orWhereIn(column: `${string}.${string}`, values: BaseValues[]): this;
|
|
3919
3948
|
/**
|
|
3920
3949
|
* @description Adds a WHERE NOT IN condition to the query.
|
|
3921
3950
|
* @warning If the array is empty, it will add an obvious condition to make it true.
|
|
3922
3951
|
*/
|
|
3923
|
-
whereNotIn(column:
|
|
3924
|
-
whereNotIn<
|
|
3952
|
+
whereNotIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3953
|
+
whereNotIn<K extends ModelKey<T>>(column: K, values: T[K][]): this;
|
|
3954
|
+
whereNotIn(column: `${string}.${string}`, values: BaseValues[]): this;
|
|
3925
3955
|
/**
|
|
3926
3956
|
* @description Adds an OR WHERE NOT IN condition to the query.
|
|
3927
3957
|
* @warning If the array is empty, it will add an obvious condition to make it true.
|
|
3928
3958
|
*/
|
|
3929
|
-
andWhereNotIn(column:
|
|
3930
|
-
andWhereNotIn<
|
|
3959
|
+
andWhereNotIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3960
|
+
andWhereNotIn<K extends ModelKey<T>>(column: K, values: T[K][]): this;
|
|
3961
|
+
andWhereNotIn(column: `${string}.${string}`, values: BaseValues[]): this;
|
|
3931
3962
|
/**
|
|
3932
3963
|
* @description Adds an OR WHERE NOT IN condition to the query.
|
|
3933
3964
|
* @warning If the array is empty, it will add an obvious condition to make it true.
|
|
3934
3965
|
*/
|
|
3935
|
-
orWhereNotIn(column:
|
|
3936
|
-
orWhereNotIn<
|
|
3966
|
+
orWhereNotIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void)): this;
|
|
3967
|
+
orWhereNotIn<K extends ModelKey<T>>(column: K, values: T[K][]): this;
|
|
3968
|
+
orWhereNotIn(column: `${string}.${string}`, values: BaseValues[]): this;
|
|
3937
3969
|
/**
|
|
3938
3970
|
* @description Adds a WHERE NULL condition to the query.
|
|
3939
3971
|
*/
|
|
@@ -4045,18 +4077,25 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
4045
4077
|
/**
|
|
4046
4078
|
* @description Adds a HAVING condition to the query.
|
|
4047
4079
|
*/
|
|
4048
|
-
having<
|
|
4049
|
-
having
|
|
4080
|
+
having<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
|
|
4081
|
+
having<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType, value: WhereColumnValue<T, K>): this;
|
|
4082
|
+
having(column: `${string}.${string}`, value: any): this;
|
|
4083
|
+
having(column: `${string}.${string}`, operator: BinaryOperatorType, value: any): this;
|
|
4050
4084
|
/**
|
|
4051
4085
|
* @description Adds an AND HAVING condition to the query.
|
|
4052
4086
|
*/
|
|
4053
|
-
andHaving<
|
|
4087
|
+
andHaving<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
|
|
4088
|
+
andHaving<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType, value: WhereColumnValue<T, K>): this;
|
|
4089
|
+
andHaving(column: `${string}.${string}`, value: any): this;
|
|
4090
|
+
andHaving(column: `${string}.${string}`, operator: BinaryOperatorType, value: any): this;
|
|
4054
4091
|
andHaving(column: ModelKey<T>, operator: BinaryOperatorType, value: any): this;
|
|
4055
4092
|
/**
|
|
4056
4093
|
* @description Adds an OR HAVING condition to the query.
|
|
4057
4094
|
*/
|
|
4058
|
-
orHaving<
|
|
4059
|
-
orHaving
|
|
4095
|
+
orHaving<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
|
|
4096
|
+
orHaving<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType, value: WhereColumnValue<T, K>): this;
|
|
4097
|
+
orHaving(column: `${string}.${string}`, value: any): this;
|
|
4098
|
+
orHaving(column: `${string}.${string}`, operator: BinaryOperatorType, value: any): this;
|
|
4060
4099
|
/**
|
|
4061
4100
|
* @description Adds a raw HAVING condition to the query.
|
|
4062
4101
|
*/
|
|
@@ -4514,19 +4553,19 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
|
|
|
4514
4553
|
update(data: Partial<ModelWithoutRelations<T>>, options?: UpdateOptions): WriteOperation<number>;
|
|
4515
4554
|
softDelete(options?: SoftDeleteOptions<T>): WriteOperation<number>;
|
|
4516
4555
|
delete(options?: DeleteOptions): WriteOperation<number>;
|
|
4517
|
-
getCount(column?: string, options?: {
|
|
4556
|
+
getCount(column?: (ModelKey<T> & string) | "*" | (string & {}), options?: {
|
|
4518
4557
|
ignoreHooks: boolean;
|
|
4519
4558
|
}): Promise<number>;
|
|
4520
|
-
getMax(column: string, options?: {
|
|
4559
|
+
getMax(column: (ModelKey<T> & string) | (string & {}), options?: {
|
|
4521
4560
|
ignoreHooks: boolean;
|
|
4522
4561
|
}): Promise<number>;
|
|
4523
|
-
getMin(column: string, options?: {
|
|
4562
|
+
getMin(column: (ModelKey<T> & string) | (string & {}), options?: {
|
|
4524
4563
|
ignoreHooks: boolean;
|
|
4525
4564
|
}): Promise<number>;
|
|
4526
|
-
getAvg(column: string, options?: {
|
|
4565
|
+
getAvg(column: (ModelKey<T> & string) | (string & {}), options?: {
|
|
4527
4566
|
ignoreHooks: boolean;
|
|
4528
4567
|
}): Promise<number>;
|
|
4529
|
-
getSum(column: string, options?: {
|
|
4568
|
+
getSum(column: (ModelKey<T> & string) | (string & {}), options?: {
|
|
4530
4569
|
ignoreHooks: boolean;
|
|
4531
4570
|
}): Promise<number>;
|
|
4532
4571
|
paginate(page: number, perPage: number, options?: {
|
|
@@ -6024,6 +6063,11 @@ type WhereType<T> = BaseWhereType<T> & {
|
|
|
6024
6063
|
type ModelKey<T extends Model> = {
|
|
6025
6064
|
[K in keyof T]: T[K] extends NullableAndUndefinable<Model> | NullableAndUndefinable<Model[]> ? never : K extends "*" ? never : T[K] extends (...args: any[]) => any ? never : K;
|
|
6026
6065
|
}[keyof T];
|
|
6066
|
+
/**
|
|
6067
|
+
* Extracts the value type for a model column key, adding `null` for SQL compatibility.
|
|
6068
|
+
* Used in type-safe where/having clauses to infer value types from column keys.
|
|
6069
|
+
*/
|
|
6070
|
+
type WhereColumnValue<T extends Model, K extends ModelKey<T>> = T[K] | null;
|
|
6027
6071
|
type ModelRelation<T extends Model> = OnlyRelations<T>;
|
|
6028
6072
|
type OrderByChoices = "asc" | "desc";
|
|
6029
6073
|
type OrderByType<T extends Model> = {
|
|
@@ -7766,6 +7810,8 @@ declare class Schema {
|
|
|
7766
7810
|
*/
|
|
7767
7811
|
createExtension(extensionName: CommonPostgresExtensions, ifNotExists?: boolean): void;
|
|
7768
7812
|
createExtension(extensionName: string, ifNotExists?: boolean): void;
|
|
7813
|
+
private generateAutoUpdateTriggers;
|
|
7814
|
+
private getAutoUpdateTriggerSql;
|
|
7769
7815
|
private generateAstInstance;
|
|
7770
7816
|
}
|
|
7771
7817
|
|