pqb 0.58.2 → 0.58.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 +39 -48
- package/dist/index.js +67 -67
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2124,9 +2124,7 @@ declare class ValExpression extends Expression {
|
|
|
2124
2124
|
};
|
|
2125
2125
|
q: ExpressionData;
|
|
2126
2126
|
constructor(value: unknown);
|
|
2127
|
-
makeSQL(ctx:
|
|
2128
|
-
values: unknown[];
|
|
2129
|
-
}): string;
|
|
2127
|
+
makeSQL(ctx: ToSqlValues): string;
|
|
2130
2128
|
}
|
|
2131
2129
|
|
|
2132
2130
|
interface QueryReturnsFnAdd<T extends PickQueryColumTypes> extends QueryMetaHasSelect {
|
|
@@ -2665,7 +2663,7 @@ declare class UUIDColumn<Schema extends ColumnSchemaConfig> extends Column<Schem
|
|
|
2665
2663
|
T & {
|
|
2666
2664
|
data: {
|
|
2667
2665
|
primaryKey: Name;
|
|
2668
|
-
default:
|
|
2666
|
+
default: RawSqlBase;
|
|
2669
2667
|
};
|
|
2670
2668
|
};
|
|
2671
2669
|
toCode(ctx: ColumnToCodeCtx, key: string): Code;
|
|
@@ -3101,7 +3099,7 @@ type MapTableScopesOption<T> = T extends {
|
|
|
3101
3099
|
interface DbResult<ColumnTypes> extends Db<string, never, never, never, never, never, ColumnTypes>, DbTableConstructor<ColumnTypes> {
|
|
3102
3100
|
adapter: AdapterBase;
|
|
3103
3101
|
close: AdapterBase['close'];
|
|
3104
|
-
sql<T = unknown>(...args: StaticSQLArgs):
|
|
3102
|
+
sql<T = unknown>(...args: StaticSQLArgs): RawSql<Column.Pick.QueryColumnOfType<T>, ColumnTypes>;
|
|
3105
3103
|
sql<T = unknown>(...args: [DynamicSQLArg<Column.Pick.QueryColumnOfType<T>>]): DynamicRawSQL<Column.Pick.QueryColumnOfType<T>, ColumnTypes>;
|
|
3106
3104
|
}
|
|
3107
3105
|
/**
|
|
@@ -3183,7 +3181,7 @@ interface DbResult<ColumnTypes> extends Db<string, never, never, never, never, n
|
|
|
3183
3181
|
declare const createDbWithAdapter: <SchemaConfig extends ColumnSchemaConfig<Column.Pick.Data> = DefaultSchemaConfig, ColumnTypes = DefaultColumnTypes<SchemaConfig>>({ log, logger, snakeCase, schemaConfig, columnTypes: ctOrFn, ...options }: DbOptionsWithAdapter<SchemaConfig, ColumnTypes>) => DbResult<ColumnTypes>;
|
|
3184
3182
|
declare const _initQueryBuilder: (adapter: AdapterBase, columnTypes: unknown, transactionStorage: AsyncLocalStorage<TransactionState>, commonOptions: DbTableOptions<unknown, undefined, Column.QueryColumns>, options: DbSharedOptions) => Db;
|
|
3185
3183
|
|
|
3186
|
-
type SQLQueryArgs = TemplateLiteralArgs | [
|
|
3184
|
+
type SQLQueryArgs = TemplateLiteralArgs | [RawSqlBase];
|
|
3187
3185
|
interface DbSqlQuery {
|
|
3188
3186
|
<T extends QueryResultRow = QueryResultRow>(...args: SQLQueryArgs): Promise<QueryResult<T>>;
|
|
3189
3187
|
/**
|
|
@@ -6695,7 +6693,7 @@ declare namespace TableData {
|
|
|
6695
6693
|
references?: References;
|
|
6696
6694
|
dropMode?: TableData.DropMode;
|
|
6697
6695
|
}
|
|
6698
|
-
export type Check =
|
|
6696
|
+
export type Check = RawSqlBase;
|
|
6699
6697
|
export interface ColumnReferences {
|
|
6700
6698
|
fnOrTable: TableData.References.FnOrTable;
|
|
6701
6699
|
foreignColumns: string[];
|
|
@@ -6933,7 +6931,7 @@ interface TableDataMethods<Key extends PropertyKey> {
|
|
|
6933
6931
|
};
|
|
6934
6932
|
}, foreignColumns: [keyof Shape, ...(keyof Shape)[]], options?: TableData.References.Options): NonUniqDataItem;
|
|
6935
6933
|
foreignKey(columns: [string, ...string[]], fnOrTable: string, foreignColumns: [string, ...string[]], options?: TableData.References.Options): NonUniqDataItem;
|
|
6936
|
-
check(check:
|
|
6934
|
+
check(check: RawSqlBase, name?: string): NonUniqDataItem;
|
|
6937
6935
|
sql: SqlFn;
|
|
6938
6936
|
}
|
|
6939
6937
|
type TableDataItemsUniqueColumns<Shape extends Column.QueryColumns, T extends MaybeArray<TableDataItem>> = MaybeArray<TableDataItem> extends T ? never : T extends UniqueTableDataItem<Shape> ? ItemUniqueColumns<Shape, T> : T extends unknown[] ? {
|
|
@@ -7109,8 +7107,8 @@ declare class BooleanColumn<Schema extends ColumnSchemaConfig> extends Column<Sc
|
|
|
7109
7107
|
}
|
|
7110
7108
|
|
|
7111
7109
|
interface Timestamps<T extends Column.Pick.Data> {
|
|
7112
|
-
createdAt: Column.Modifiers.Default<T,
|
|
7113
|
-
updatedAt: Column.Modifiers.Default<T,
|
|
7110
|
+
createdAt: Column.Modifiers.Default<T, RawSqlBase>;
|
|
7111
|
+
updatedAt: Column.Modifiers.Default<T, RawSqlBase>;
|
|
7114
7112
|
}
|
|
7115
7113
|
interface TimestampHelpers {
|
|
7116
7114
|
/**
|
|
@@ -7221,30 +7219,27 @@ interface DefaultColumnTypes<SchemaConfig extends ColumnSchemaConfig> extends Ti
|
|
|
7221
7219
|
declare const makeColumnTypes: <SchemaConfig extends ColumnSchemaConfig<Column.Pick.Data>>(schema: SchemaConfig) => DefaultColumnTypes<SchemaConfig>;
|
|
7222
7220
|
|
|
7223
7221
|
declare const setRawSqlPrepareSubQueryForSql: (fn: PrepareSubQueryForSql) => void;
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
declare abstract class RawSQLBase<T extends Column.Pick.QueryColumn = Column.Pick.QueryColumn, ColumnTypes = unknown> extends Expression<T> {
|
|
7222
|
+
declare const templateLiteralToSQL: (template: TemplateLiteralArgs, ctx: ToSqlValues, quotedAs?: string) => string;
|
|
7223
|
+
interface RawSqlBase extends Expression {
|
|
7227
7224
|
_sql: string | TemplateLiteralArgs;
|
|
7228
|
-
_values?:
|
|
7225
|
+
_values?: RawSQLValues;
|
|
7226
|
+
}
|
|
7227
|
+
interface RawSql<T extends Column.Pick.QueryColumn, ColumnTypes> extends Expression<T>, RawSqlBase, ExpressionTypeMethod {
|
|
7228
|
+
}
|
|
7229
|
+
declare class RawSql<T extends Column.Pick.QueryColumn = Column.Pick.QueryColumn, ColumnTypes = DefaultColumnTypes<ColumnSchemaConfig>> extends Expression<T> {
|
|
7229
7230
|
result: {
|
|
7230
7231
|
value: T;
|
|
7231
7232
|
};
|
|
7232
|
-
q: ExpressionData;
|
|
7233
|
-
abstract columnTypes: ColumnTypes;
|
|
7234
|
-
abstract makeSQL(ctx: {
|
|
7235
|
-
values: unknown[];
|
|
7236
|
-
}): string;
|
|
7237
|
-
constructor(_sql: string | TemplateLiteralArgs, _values?: RecordUnknown | undefined);
|
|
7238
|
-
values<Self extends RawSQLBase>(this: Self, values: RawSQLValues): Self;
|
|
7239
|
-
toCode(t: string): string;
|
|
7240
|
-
}
|
|
7241
|
-
declare const isRawSQL: (arg: unknown) => arg is RawSQLBase<Column.Pick.QueryColumn, unknown>;
|
|
7242
|
-
declare const templateLiteralToSQL: (template: TemplateLiteralArgs, ctx: ToSQLCtx, quotedAs?: string) => string;
|
|
7243
|
-
declare class RawSQL<T extends Column.Pick.QueryColumn, ColumnTypes = DefaultColumnTypes<ColumnSchemaConfig>> extends RawSQLBase<T, ColumnTypes> {
|
|
7244
7233
|
columnTypes: ColumnTypes;
|
|
7234
|
+
q: ExpressionData;
|
|
7235
|
+
_sql: string | TemplateLiteralArgs;
|
|
7236
|
+
_values?: RawSQLValues;
|
|
7245
7237
|
constructor(sql: string | TemplateLiteralArgs, values?: RawSQLValues, type?: T);
|
|
7246
|
-
|
|
7238
|
+
values<Self extends RawSqlBase>(this: Self, values: RawSQLValues): Self;
|
|
7239
|
+
makeSQL(ctx: ToSqlValues, quotedAs?: string): string;
|
|
7247
7240
|
}
|
|
7241
|
+
declare const isRawSQL: (arg: unknown) => arg is RawSqlBase;
|
|
7242
|
+
declare const rawSqlToCode: (rawSql: RawSqlBase, t: string) => string;
|
|
7248
7243
|
interface DynamicRawSQL<T extends Column.Pick.QueryColumn> extends Expression<T>, ExpressionTypeMethod {
|
|
7249
7244
|
}
|
|
7250
7245
|
declare class DynamicRawSQL<T extends Column.Pick.QueryColumn, ColumnTypes = DefaultColumnTypes<ColumnSchemaConfig>> extends Expression<T> {
|
|
@@ -7258,12 +7253,12 @@ declare class DynamicRawSQL<T extends Column.Pick.QueryColumn, ColumnTypes = Def
|
|
|
7258
7253
|
constructor(fn: DynamicSQLArg<T>);
|
|
7259
7254
|
makeSQL(ctx: ToSQLCtx, quotedAs?: string): string;
|
|
7260
7255
|
}
|
|
7261
|
-
declare function raw<T = never>(...args: StaticSQLArgs):
|
|
7256
|
+
declare function raw<T = never>(...args: StaticSQLArgs): RawSql<Column.Pick.QueryColumnOfType<T>>;
|
|
7262
7257
|
declare function raw<T = never>(...args: [DynamicSQLArg<Column.Pick.QueryColumnOfType<T>>]): DynamicRawSQL<Column.Pick.QueryColumnOfType<T>>;
|
|
7263
|
-
declare const countSelect:
|
|
7264
|
-
declare function sqlQueryArgsToExpression(args: SQLQueryArgs):
|
|
7258
|
+
declare const countSelect: RawSql<Column.Pick.QueryColumn, DefaultColumnTypes<ColumnSchemaConfig<Column.Pick.Data>>>[];
|
|
7259
|
+
declare function sqlQueryArgsToExpression(args: SQLQueryArgs): RawSqlBase;
|
|
7265
7260
|
interface SqlFn {
|
|
7266
|
-
<T, Args extends [sql: TemplateStringsArray, ...values: unknown[]] | [sql: string] | [values: RecordUnknown, sql?: string]>(this: T, ...args: Args): Args extends [RecordUnknown] ? (...sql: TemplateLiteralArgs) =>
|
|
7261
|
+
<T, Args extends [sql: TemplateStringsArray, ...values: unknown[]] | [sql: string] | [values: RecordUnknown, sql?: string]>(this: T, ...args: Args): Args extends [RecordUnknown] ? (...sql: TemplateLiteralArgs) => RawSql<Column.Pick.QueryColumn, T> : RawSql<Column.Pick.QueryColumn, T>;
|
|
7267
7262
|
}
|
|
7268
7263
|
declare const sqlFn: SqlFn;
|
|
7269
7264
|
|
|
@@ -7431,7 +7426,7 @@ declare class QuerySql<ColumnTypes> {
|
|
|
7431
7426
|
* @param args - template literal or an object { raw: string }
|
|
7432
7427
|
* @return object that has `type` and `values` methods
|
|
7433
7428
|
*/
|
|
7434
|
-
sql<T = unknown>(this: PickQueryColumTypes, ...args: StaticSQLArgs):
|
|
7429
|
+
sql<T = unknown>(this: PickQueryColumTypes, ...args: StaticSQLArgs): RawSql<Column.Pick.QueryColumnOfType<T>, ColumnTypes>;
|
|
7435
7430
|
sql<T = unknown>(this: PickQueryColumTypes, ...args: [DynamicSQLArg<Column.Pick.QueryColumnOfType<T>>]): DynamicRawSQL<Column.Pick.QueryColumnOfType<T>, ColumnTypes>;
|
|
7436
7431
|
}
|
|
7437
7432
|
|
|
@@ -7757,12 +7752,8 @@ declare abstract class Expression<T extends Column.Pick.QueryColumn = Column.Pic
|
|
|
7757
7752
|
meta: {
|
|
7758
7753
|
kind: 'select';
|
|
7759
7754
|
};
|
|
7760
|
-
toSQL(ctx:
|
|
7761
|
-
|
|
7762
|
-
}, quotedAs?: string): string;
|
|
7763
|
-
abstract makeSQL(ctx: {
|
|
7764
|
-
values: unknown[];
|
|
7765
|
-
}, quotedAs?: string): string;
|
|
7755
|
+
toSQL(ctx: ToSqlValues, quotedAs?: string): string;
|
|
7756
|
+
abstract makeSQL(ctx: ToSqlValues, quotedAs?: string): string;
|
|
7766
7757
|
}
|
|
7767
7758
|
declare const isExpression: (arg: unknown) => arg is Expression<Column.Pick.QueryColumn>;
|
|
7768
7759
|
type TemplateLiteralArgs = [
|
|
@@ -8049,7 +8040,7 @@ declare namespace Column {
|
|
|
8049
8040
|
}
|
|
8050
8041
|
export namespace Data {
|
|
8051
8042
|
interface Check {
|
|
8052
|
-
sql:
|
|
8043
|
+
sql: RawSqlBase;
|
|
8053
8044
|
name?: string;
|
|
8054
8045
|
}
|
|
8055
8046
|
interface Generated {
|
|
@@ -8118,13 +8109,13 @@ declare abstract class Column<Schema extends ColumnTypeSchemaArg = ColumnTypeSch
|
|
|
8118
8109
|
*
|
|
8119
8110
|
* @param value - default value or a function returning a value
|
|
8120
8111
|
*/
|
|
8121
|
-
default<T extends Column.Pick.DataAndInputType, Value extends T['inputType'] | null |
|
|
8112
|
+
default<T extends Column.Pick.DataAndInputType, Value extends T['inputType'] | null | RawSqlBase | (() => T['inputType'])>(this: T, value: Value): Column.Modifiers.Default<T, Value>;
|
|
8122
8113
|
/**
|
|
8123
8114
|
* Use `hasDefault` to let the column be omitted when creating records.
|
|
8124
8115
|
*
|
|
8125
8116
|
* It's better to use {@link default} instead so the value is explicit and serves as a hint.
|
|
8126
8117
|
*/
|
|
8127
|
-
hasDefault<T extends Column.Pick.Data>(this: T): Column.Modifiers.Default<T,
|
|
8118
|
+
hasDefault<T extends Column.Pick.Data>(this: T): Column.Modifiers.Default<T, RawSqlBase>;
|
|
8128
8119
|
/**
|
|
8129
8120
|
* Set a database-level validation check to a column. `check` accepts a raw SQL.
|
|
8130
8121
|
*
|
|
@@ -8149,7 +8140,7 @@ declare abstract class Column<Schema extends ColumnTypeSchemaArg = ColumnTypeSch
|
|
|
8149
8140
|
* @param sql - raw SQL expression
|
|
8150
8141
|
* @param name - to specify a constraint name
|
|
8151
8142
|
*/
|
|
8152
|
-
check<T extends Column.Pick.Data>(this: T, sql:
|
|
8143
|
+
check<T extends Column.Pick.Data>(this: T, sql: RawSqlBase, name?: string): T;
|
|
8153
8144
|
/**
|
|
8154
8145
|
* Use `nullable` to mark the column as nullable. By default, all columns are required.
|
|
8155
8146
|
*
|
|
@@ -9231,27 +9222,27 @@ declare const pushQueryValueImmutable: <T extends IsQuery>(q: T, key: string, va
|
|
|
9231
9222
|
declare const getClonedQueryData: (query: QueryData) => QueryData;
|
|
9232
9223
|
|
|
9233
9224
|
interface ToSqlOptionsInternal {
|
|
9234
|
-
values?: unknown[];
|
|
9235
9225
|
hasNonSelect?: boolean;
|
|
9236
9226
|
aliasValue?: true;
|
|
9237
9227
|
skipBatchCheck?: true;
|
|
9238
9228
|
selectedCount?: number;
|
|
9239
9229
|
selectList?: string[];
|
|
9240
9230
|
}
|
|
9241
|
-
interface
|
|
9231
|
+
interface ToSqlValues {
|
|
9232
|
+
values: unknown[];
|
|
9233
|
+
}
|
|
9234
|
+
interface TopToSqlCtx extends ToSqlOptionsInternal, HasCteHooks, ToSqlValues {
|
|
9242
9235
|
topCtx: TopToSqlCtx;
|
|
9243
9236
|
topCTE?: TopCTE;
|
|
9244
|
-
values: unknown[];
|
|
9245
9237
|
tableHook?: TableHook;
|
|
9246
9238
|
delayedRelationSelect?: DelayedRelationSelect;
|
|
9247
9239
|
cteHookTopNullSelectAppended?: boolean;
|
|
9248
9240
|
}
|
|
9249
|
-
interface ToSQLCtx extends ToSqlOptionsInternal {
|
|
9241
|
+
interface ToSQLCtx extends ToSqlOptionsInternal, ToSqlValues {
|
|
9250
9242
|
topCtx: TopToSqlCtx;
|
|
9251
9243
|
qb: QueryBuilder;
|
|
9252
9244
|
q: QueryData;
|
|
9253
9245
|
sql: string[];
|
|
9254
|
-
values: unknown[];
|
|
9255
9246
|
selectedCount: number;
|
|
9256
9247
|
cteSqls?: string[];
|
|
9257
9248
|
cteName?: string;
|
|
@@ -11082,4 +11073,4 @@ declare const testTransaction: {
|
|
|
11082
11073
|
close(arg: Arg): Promise<void>;
|
|
11083
11074
|
};
|
|
11084
11075
|
|
|
11085
|
-
export { type AdapterBase, type AdapterConfigBase, type AdapterConfigConnectRetry, type AddQueryDefaults, type AdditionalDateData, type AdditionalNumberData, type AdditionalStringData, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterCommitHook, type AfterCommitStandaloneHook, type AfterHook, type AggregateOptions, type AliasOrTable, type ArgWithBeforeAndBeforeSet, ArrayColumn, type ArrayColumnValue, type ArrayData, type ArrayMethodsData, type ArrayMethodsDataForBaseColumn, type AsQueryArg, type BaseNumberData, type BatchSql, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, ColumnRefExpression, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, ColumnsShape, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateBelongsToData, type CreateColumn, type CreateCtx, type CreateData, type CreateFromMethodNames, type CreateManyFromMethodNames, type CreateManyMethodsNames, type CreateMethodsNames, type CreateRelationsData, type CreateRelationsDataOmittingFKeys, type CreateResult, type CreateSelf, type CteArgsOptions, type CteHooks, type CteItem, type CteOptions, CteQuery, type CteQueryBuilder, type CteRecursiveOptions, type CteResult, type CteSqlResult, type CteTableHook, type CteTableHooks, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbOptionsWithAdapter, type DbResult, type DbSharedOptions, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, type DelayedRelationSelect, Delete, type DeleteArgs, type DeleteMethodsNames, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, type DynamicSQLArg, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionChain, type ExpressionData, type ExpressionOutput, ExpressionTypeMethod, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, type FnUnknownToUnknown, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratorIgnore, type GroupArgs, type HandleResult, type HasBeforeAndBeforeSet, type HasCteHooks, type HasHookSelect, type HasTableHook, type HavingItem, type HookAction, type HookSelect, type HookSelectArg, type HookSelectValue, type IdentityColumn, InetColumn, type InsertQueryDataObjectValues, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQueries, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultFromArgs, type JoinResultRequireMain, type JoinResultSelectable, type JoinValueDedupItem, type JoinedParsers, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, type MoveMutativeQueryToCte, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, OnConflictQueryBuilder, type OnConflictSet, type OnConflictTarget, OnMethods, type Operator, type OperatorToSQL, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, type OperatorsTime, type OrCreateArg, OrExpression, type OrExpressionArg, OrchidOrmError, OrchidOrmInternalError, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickQueryBaseQuery, type PickQueryColumTypes, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryInputType, type PickQueryInternal, type PickQueryMeta, type PickQueryMetaColumnTypes, type PickQueryMetaRelations, type PickQueryMetaRelationsResult, type PickQueryMetaRelationsResultReturnType, type PickQueryMetaRelationsReturnType, type PickQueryMetaResult, type PickQueryMetaResultRelations, type PickQueryMetaResultRelationsWindows, type PickQueryMetaResultRelationsWindowsColumnTypes, type PickQueryMetaResultRelationsWithDataReturnType, type PickQueryMetaResultRelationsWithDataReturnTypeShape, type PickQueryMetaResultReturnType, type PickQueryMetaResultReturnTypeWithDataWindows, type PickQueryMetaResultReturnTypeWithDataWindowsThen, type PickQueryMetaResultWindows, type PickQueryMetaReturnType, type PickQueryMetaShape, type PickQueryMetaShapeRelationsReturnType, type PickQueryMetaShapeRelationsWithData, type PickQueryMetaTable, type PickQueryMetaTableShape, type PickQueryMetaTableShapeReturnTypeWithData, type PickQueryMetaWithData, type PickQueryMetaWithDataColumnTypes, type PickQueryQ, type PickQueryQAndBaseQuery, type PickQueryQAndInternal, type PickQueryRelationQueries, type PickQueryRelations, type PickQueryRelationsWithData, type PickQueryResult, type PickQueryResultColumnTypes, type PickQueryResultReturnType, type PickQueryResultReturnTypeUniqueColumns, type PickQueryResultUniqueColumns, type PickQueryReturnType, type PickQueryShape, type PickQueryShapeResultReturnTypeSinglePrimaryKey, type PickQueryShapeResultSinglePrimaryKey, type PickQueryShapeSinglePrimaryKey, type PickQuerySinglePrimaryKey, type PickQueryTable, type PickQueryTableMetaResult, type PickQueryTableMetaResultInputType, type PickQueryTableMetaResultReturnTypeWithDataWindowsThen, type PickQueryTableMetaResultShape, type PickQueryTableMetaShape, type PickQueryUniqueProperties, type PickQueryWindows, type PickQueryWithData, type PickQueryWithDataColumnTypes, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type PrepareSubQueryForSql, type PrepareSubQueryForSqlArg, type Query, type QueryAfterHook, type QueryArraysResult, QueryAsMethods, type QueryBase, type QueryBaseCommon, type QueryBatchResult, type QueryBeforeHook, type QueryBeforeHookInternal, type QueryBuilder, type QueryCatch, type QueryCatchers, QueryClone, type QueryComputedArg, QueryCreate, QueryCreateFrom, type QueryData, type QueryDataAliases, type QueryDataBase, type QueryDataFromItem, type QueryDataJoinTo, type QueryDataScopes, type QueryDataSources, type QueryDataTransform, type QueryDataUnion, QueryError, type QueryErrorName, QueryExpressions, QueryGet, type QueryHelperResult, QueryHookUtils, QueryHooks, type QueryIfResultThen, type QueryInternal, type QueryInternalBase, type QueryInternalColumnNameToKey, type QueryInternalTableDataBase, QueryJoin, QueryLog, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryMetaBase, type QueryMetaHasSelect, type QueryMetaHasWhere, type QueryMetaIsSubQuery, QueryMethods, QueryOrCreate, type QueryOrExpression, type QueryOrExpressionBooleanOrNullResult, type QueryResult, type QueryResultRow, type QueryReturnType, type QueryReturnTypeAll, type QueryReturnTypeOptional, QueryScope, type QueryScopeData, type QueryScopes, type QuerySelectable, type QuerySourceItem, QuerySql, type QueryTake, type QueryTakeOptional, type QueryThen, type QueryThenByQuery, type QueryThenByReturnType, type QueryThenShallowSimplify, type QueryThenShallowSimplifyArr, type QueryThenShallowSimplifyOptional, QueryTransform, QueryWrap, RawSQL, RawSQLBase, type RawSQLValues, RealColumn, type RecordBoolean, type RecordKeyTrue, type RecordOfColumnsShapeBase, type RecordOptionalString, type RecordString, type RecordUnknown, RefExpression, type RelationConfigBase, type RelationConfigDataForCreate, type RelationConfigQuery, type RelationJoinQuery, type RelationsBase, type ReturnsQueryOrExpression, type RunAfterQuery, type RuntimeComputedQueryColumn, type SQLArgs, type SQLQueryArgs, type ScopeArgumentQuery, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsArg, type SelectAsFnArg, type SelectAsValue, type SelectItem, type SelectSelf, type SelectSubQueryResult, type SelectableFromShape, type SelectableOfType, type SelectableOrExpression, type SelectableOrExpressionOfType, type SelectableOrExpressions, SerialColumn, type SerialColumnData, type SetQueryKind, type SetQueryKindResult, type SetQueryReturnsAll, type SetQueryReturnsAllKind, type SetQueryReturnsAllKindResult, type SetQueryReturnsColumnKind, type SetQueryReturnsColumnKindResult, type SetQueryReturnsColumnOptional, type SetQueryReturnsColumnOrThrow, type SetQueryReturnsOneKind, type SetQueryReturnsOneKindResult, type SetQueryReturnsPluck, type SetQueryReturnsPluckColumn, type SetQueryReturnsPluckColumnKind, type SetQueryReturnsPluckColumnKindResult, type SetQueryReturnsRowCount, type SetQueryReturnsRowCountMany, type SetQueryReturnsRows, type SetQueryReturnsValueOptional, type SetQueryReturnsValueOrThrow, type SetQueryReturnsValueOrThrowKind, type SetQueryReturnsVoid, type SetQueryReturnsVoidKind, type SetQueryTableAlias, type ShallowSimplify, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type SortDir, type Sql, type SqlCommonOptions, type SqlFn, type StaticSQLArgs, StringColumn$1 as StringColumn, type StringData, type SubQueryForSql, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TableHook, type TemplateLiteralArgs, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, type TimeInterval, TimestampColumn, type TimestampHelpers, TimestampTZColumn, type Timestamps, type TopCTE, Transaction, type TransactionAfterCommitHook, type TransactionOptions, type TransactionState, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, type UnionItem, type UnionKind, type UnionSet, type UnionToIntersection, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, Update, type UpdateArg, type UpdateCtx, type UpdateCtxCollect, type UpdateData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, VarCharColumn, VirtualColumn, Where, type WhereArg, type WhereArgs, type WhereInArg, type WhereInColumn, type WhereInItem, type WhereInValues, type WhereItem, type WhereJsonPathEqualsItem, type WhereNotArgs, type WhereOnItem, type WhereOnJoinItem, type WhereQueryBuilder, type WhereResult, type WhereSearchItem, type WindowDeclaration, type WindowItem, type WithConfig, type WithConfigs, type WithDataItem, type WithDataItems, type WithItems, type WrapQueryArg, XMLColumn, _addToHookSelect, _addToHookSelectWithTable, _applyRelationAliases, _checkIfAliased, _clone, _copyQueryAliasToQuery, _getQueryAliasOrName, _getQueryAs, _getQueryFreeAlias, _getQueryOuterAliases, _initQueryBuilder, _join, _joinLateral, _joinLateralProcessArg, _joinReturningArgs, _orCreate, _queryAfterSaveCommit, _queryAll, _queryChangeCounter, _queryCreate, _queryCreateForEachFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateOneFrom, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertOneFrom, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _querySelectAll, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotExists, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, _setQueryAlias, _setQueryAs, _setSubQueryAliases, _with, addCode, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, addTopCte, addValue, addWithToSql, anyShape, applyBatchTransforms, applyComputedColumns, applyMixins, applyTransforms, arrayDataToCode, arrayMethodNames, assignDbDataToColumn, backtickQuote, callWithThis, checkIfASimpleQuery, cloneQueryBaseUnscoped, codeToString, colors, columnCheckToCode, columnCode, columnDefaultArgumentToCode, columnErrorMessagesToCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnMethodsToCode, columnsShapeToCode, commitSql, composeCteSingleSql, constraintInnerToCode, constraintToCode, consumeColumnName, countSelect, createCtx, createDbWithAdapter, createSelect, cteToSql, ctesToSql, dateDataToCode, dateMethodNames, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, extendQuery, filterResult, finalizeNestedHookSelect, foreignKeyArgumentToCode, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDefaultLanguage, getDefaultNowFn, getFreeAlias, getFreeSetAlias, getFromSelectColumns, getFullColumnTable, getImportPath, getPrimaryKeys, getQueryAs, getSearchLang, getSearchText, getShapeFromSelect, getSqlText, getStackTrace, getTopCteSize, handleManyData, handleOneData, handleResult, havingToSql, identityToCode, indexInnerToCode, indexToCode, insert, isDefaultTimeStamp, isExpression, isInUserTransaction, isIterable, isObjectEmpty, isQuery, isQueryReturnsAll, isRawSQL, isRelationQuery, isTemplateLiteralArgs, joinSubQuery, joinTruthy, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeFnExpression, makeInsertSql, makeReturningSql, makeRowToJson, moveMutativeQueryToCte, newDelayedRelationSelect, noop, numberDataToCode, numberMethodNames, objectHasValues, omit, orderByToSql, parseRecord, parseTableData, parseTableDataInput, pathToLog, performQuery, pick, pluralize, postgisTypmodToSql, prepareOpArg, prepareSubQueryForSql, prependTopCte, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processJoinItem, processSelectArg, pushColumnData, pushHavingSql, pushJoinSql, pushOrNewArray, pushOrNewArrayToObjectImmutable, pushOrderBySql, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValueImmutable, pushTableDataCode, pushUnionSql, pushWhereStatementSql, pushWhereToSql, queryColumnNameToKey, queryFrom, queryFromSql, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, quoteObjectKey, quoteSchemaAndTable, raw, referencesArgsToCode, requirePrimaryKeys, resetDefaultNowFn, resolveSubQueryCallback, returnArg, rollbackSql, saveAliasedShape, searchSourcesToSql, selectAllSql, selectToSql, selectToSqlList, setColumnData, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setConnectRetryConfig, setCurrentColumnName, setDataValue, setDb, setDefaultLanguage, setDefaultNowFn, setDelayedRelation, setFreeAlias, setMoveMutativeQueryToCte, setObjectValueImmutable, setParserForSelectedString, setPrepareSubQueryForSql, setQueryObjectValueImmutable, setQueryOperators, setRawSqlPrepareSubQueryForSql, setSqlCtxSelectList, setTopCteSize, singleQuote, singleQuoteArray, snakeCaseKey, spreadObjectValues, sqlFn, sqlQueryArgsToExpression, stringDataToCode, stringMethodNames, tableDataMethods, templateLiteralSQLToCode, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, throwOnReadOnly, timestampHelpers, toArray, toCamelCase, toPascalCase, toSnakeCase, whereToSql, windowToSql, wrapAdapterFnWithConnectRetry };
|
|
11076
|
+
export { type AdapterBase, type AdapterConfigBase, type AdapterConfigConnectRetry, type AddQueryDefaults, type AdditionalDateData, type AdditionalNumberData, type AdditionalStringData, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterCommitHook, type AfterCommitStandaloneHook, type AfterHook, type AggregateOptions, type AliasOrTable, type ArgWithBeforeAndBeforeSet, ArrayColumn, type ArrayColumnValue, type ArrayData, type ArrayMethodsData, type ArrayMethodsDataForBaseColumn, type AsQueryArg, type BaseNumberData, type BatchSql, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, ColumnRefExpression, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, ColumnsShape, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateBelongsToData, type CreateColumn, type CreateCtx, type CreateData, type CreateFromMethodNames, type CreateManyFromMethodNames, type CreateManyMethodsNames, type CreateMethodsNames, type CreateRelationsData, type CreateRelationsDataOmittingFKeys, type CreateResult, type CreateSelf, type CteArgsOptions, type CteHooks, type CteItem, type CteOptions, CteQuery, type CteQueryBuilder, type CteRecursiveOptions, type CteResult, type CteSqlResult, type CteTableHook, type CteTableHooks, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbOptionsWithAdapter, type DbResult, type DbSharedOptions, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, type DelayedRelationSelect, Delete, type DeleteArgs, type DeleteMethodsNames, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, type DynamicSQLArg, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionChain, type ExpressionData, type ExpressionOutput, ExpressionTypeMethod, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, type FnUnknownToUnknown, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratorIgnore, type GroupArgs, type HandleResult, type HasBeforeAndBeforeSet, type HasCteHooks, type HasHookSelect, type HasTableHook, type HavingItem, type HookAction, type HookSelect, type HookSelectArg, type HookSelectValue, type IdentityColumn, InetColumn, type InsertQueryDataObjectValues, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQueries, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultFromArgs, type JoinResultRequireMain, type JoinResultSelectable, type JoinValueDedupItem, type JoinedParsers, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, type MoveMutativeQueryToCte, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, OnConflictQueryBuilder, type OnConflictSet, type OnConflictTarget, OnMethods, type Operator, type OperatorToSQL, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, type OperatorsTime, type OrCreateArg, OrExpression, type OrExpressionArg, OrchidOrmError, OrchidOrmInternalError, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickQueryBaseQuery, type PickQueryColumTypes, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryInputType, type PickQueryInternal, type PickQueryMeta, type PickQueryMetaColumnTypes, type PickQueryMetaRelations, type PickQueryMetaRelationsResult, type PickQueryMetaRelationsResultReturnType, type PickQueryMetaRelationsReturnType, type PickQueryMetaResult, type PickQueryMetaResultRelations, type PickQueryMetaResultRelationsWindows, type PickQueryMetaResultRelationsWindowsColumnTypes, type PickQueryMetaResultRelationsWithDataReturnType, type PickQueryMetaResultRelationsWithDataReturnTypeShape, type PickQueryMetaResultReturnType, type PickQueryMetaResultReturnTypeWithDataWindows, type PickQueryMetaResultReturnTypeWithDataWindowsThen, type PickQueryMetaResultWindows, type PickQueryMetaReturnType, type PickQueryMetaShape, type PickQueryMetaShapeRelationsReturnType, type PickQueryMetaShapeRelationsWithData, type PickQueryMetaTable, type PickQueryMetaTableShape, type PickQueryMetaTableShapeReturnTypeWithData, type PickQueryMetaWithData, type PickQueryMetaWithDataColumnTypes, type PickQueryQ, type PickQueryQAndBaseQuery, type PickQueryQAndInternal, type PickQueryRelationQueries, type PickQueryRelations, type PickQueryRelationsWithData, type PickQueryResult, type PickQueryResultColumnTypes, type PickQueryResultReturnType, type PickQueryResultReturnTypeUniqueColumns, type PickQueryResultUniqueColumns, type PickQueryReturnType, type PickQueryShape, type PickQueryShapeResultReturnTypeSinglePrimaryKey, type PickQueryShapeResultSinglePrimaryKey, type PickQueryShapeSinglePrimaryKey, type PickQuerySinglePrimaryKey, type PickQueryTable, type PickQueryTableMetaResult, type PickQueryTableMetaResultInputType, type PickQueryTableMetaResultReturnTypeWithDataWindowsThen, type PickQueryTableMetaResultShape, type PickQueryTableMetaShape, type PickQueryUniqueProperties, type PickQueryWindows, type PickQueryWithData, type PickQueryWithDataColumnTypes, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type PrepareSubQueryForSql, type PrepareSubQueryForSqlArg, type Query, type QueryAfterHook, type QueryArraysResult, QueryAsMethods, type QueryBase, type QueryBaseCommon, type QueryBatchResult, type QueryBeforeHook, type QueryBeforeHookInternal, type QueryBuilder, type QueryCatch, type QueryCatchers, QueryClone, type QueryComputedArg, QueryCreate, QueryCreateFrom, type QueryData, type QueryDataAliases, type QueryDataBase, type QueryDataFromItem, type QueryDataJoinTo, type QueryDataScopes, type QueryDataSources, type QueryDataTransform, type QueryDataUnion, QueryError, type QueryErrorName, QueryExpressions, QueryGet, type QueryHelperResult, QueryHookUtils, QueryHooks, type QueryIfResultThen, type QueryInternal, type QueryInternalBase, type QueryInternalColumnNameToKey, type QueryInternalTableDataBase, QueryJoin, QueryLog, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryMetaBase, type QueryMetaHasSelect, type QueryMetaHasWhere, type QueryMetaIsSubQuery, QueryMethods, QueryOrCreate, type QueryOrExpression, type QueryOrExpressionBooleanOrNullResult, type QueryResult, type QueryResultRow, type QueryReturnType, type QueryReturnTypeAll, type QueryReturnTypeOptional, QueryScope, type QueryScopeData, type QueryScopes, type QuerySelectable, type QuerySourceItem, QuerySql, type QueryTake, type QueryTakeOptional, type QueryThen, type QueryThenByQuery, type QueryThenByReturnType, type QueryThenShallowSimplify, type QueryThenShallowSimplifyArr, type QueryThenShallowSimplifyOptional, QueryTransform, QueryWrap, type RawSQLValues, RawSql, type RawSqlBase, RealColumn, type RecordBoolean, type RecordKeyTrue, type RecordOfColumnsShapeBase, type RecordOptionalString, type RecordString, type RecordUnknown, RefExpression, type RelationConfigBase, type RelationConfigDataForCreate, type RelationConfigQuery, type RelationJoinQuery, type RelationsBase, type ReturnsQueryOrExpression, type RunAfterQuery, type RuntimeComputedQueryColumn, type SQLArgs, type SQLQueryArgs, type ScopeArgumentQuery, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsArg, type SelectAsFnArg, type SelectAsValue, type SelectItem, type SelectSelf, type SelectSubQueryResult, type SelectableFromShape, type SelectableOfType, type SelectableOrExpression, type SelectableOrExpressionOfType, type SelectableOrExpressions, SerialColumn, type SerialColumnData, type SetQueryKind, type SetQueryKindResult, type SetQueryReturnsAll, type SetQueryReturnsAllKind, type SetQueryReturnsAllKindResult, type SetQueryReturnsColumnKind, type SetQueryReturnsColumnKindResult, type SetQueryReturnsColumnOptional, type SetQueryReturnsColumnOrThrow, type SetQueryReturnsOneKind, type SetQueryReturnsOneKindResult, type SetQueryReturnsPluck, type SetQueryReturnsPluckColumn, type SetQueryReturnsPluckColumnKind, type SetQueryReturnsPluckColumnKindResult, type SetQueryReturnsRowCount, type SetQueryReturnsRowCountMany, type SetQueryReturnsRows, type SetQueryReturnsValueOptional, type SetQueryReturnsValueOrThrow, type SetQueryReturnsValueOrThrowKind, type SetQueryReturnsVoid, type SetQueryReturnsVoidKind, type SetQueryTableAlias, type ShallowSimplify, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type SortDir, type Sql, type SqlCommonOptions, type SqlFn, type StaticSQLArgs, StringColumn$1 as StringColumn, type StringData, type SubQueryForSql, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TableHook, type TemplateLiteralArgs, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, type TimeInterval, TimestampColumn, type TimestampHelpers, TimestampTZColumn, type Timestamps, type TopCTE, Transaction, type TransactionAfterCommitHook, type TransactionOptions, type TransactionState, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, type UnionItem, type UnionKind, type UnionSet, type UnionToIntersection, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, Update, type UpdateArg, type UpdateCtx, type UpdateCtxCollect, type UpdateData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, VarCharColumn, VirtualColumn, Where, type WhereArg, type WhereArgs, type WhereInArg, type WhereInColumn, type WhereInItem, type WhereInValues, type WhereItem, type WhereJsonPathEqualsItem, type WhereNotArgs, type WhereOnItem, type WhereOnJoinItem, type WhereQueryBuilder, type WhereResult, type WhereSearchItem, type WindowDeclaration, type WindowItem, type WithConfig, type WithConfigs, type WithDataItem, type WithDataItems, type WithItems, type WrapQueryArg, XMLColumn, _addToHookSelect, _addToHookSelectWithTable, _applyRelationAliases, _checkIfAliased, _clone, _copyQueryAliasToQuery, _getQueryAliasOrName, _getQueryAs, _getQueryFreeAlias, _getQueryOuterAliases, _initQueryBuilder, _join, _joinLateral, _joinLateralProcessArg, _joinReturningArgs, _orCreate, _queryAfterSaveCommit, _queryAll, _queryChangeCounter, _queryCreate, _queryCreateForEachFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateOneFrom, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertOneFrom, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _querySelectAll, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotExists, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, _setQueryAlias, _setQueryAs, _setSubQueryAliases, _with, addCode, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, addTopCte, addValue, addWithToSql, anyShape, applyBatchTransforms, applyComputedColumns, applyMixins, applyTransforms, arrayDataToCode, arrayMethodNames, assignDbDataToColumn, backtickQuote, callWithThis, checkIfASimpleQuery, cloneQueryBaseUnscoped, codeToString, colors, columnCheckToCode, columnCode, columnDefaultArgumentToCode, columnErrorMessagesToCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnMethodsToCode, columnsShapeToCode, commitSql, composeCteSingleSql, constraintInnerToCode, constraintToCode, consumeColumnName, countSelect, createCtx, createDbWithAdapter, createSelect, cteToSql, ctesToSql, dateDataToCode, dateMethodNames, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, extendQuery, filterResult, finalizeNestedHookSelect, foreignKeyArgumentToCode, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDefaultLanguage, getDefaultNowFn, getFreeAlias, getFreeSetAlias, getFromSelectColumns, getFullColumnTable, getImportPath, getPrimaryKeys, getQueryAs, getSearchLang, getSearchText, getShapeFromSelect, getSqlText, getStackTrace, getTopCteSize, handleManyData, handleOneData, handleResult, havingToSql, identityToCode, indexInnerToCode, indexToCode, insert, isDefaultTimeStamp, isExpression, isInUserTransaction, isIterable, isObjectEmpty, isQuery, isQueryReturnsAll, isRawSQL, isRelationQuery, isTemplateLiteralArgs, joinSubQuery, joinTruthy, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeFnExpression, makeInsertSql, makeReturningSql, makeRowToJson, moveMutativeQueryToCte, newDelayedRelationSelect, noop, numberDataToCode, numberMethodNames, objectHasValues, omit, orderByToSql, parseRecord, parseTableData, parseTableDataInput, pathToLog, performQuery, pick, pluralize, postgisTypmodToSql, prepareOpArg, prepareSubQueryForSql, prependTopCte, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processJoinItem, processSelectArg, pushColumnData, pushHavingSql, pushJoinSql, pushOrNewArray, pushOrNewArrayToObjectImmutable, pushOrderBySql, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValueImmutable, pushTableDataCode, pushUnionSql, pushWhereStatementSql, pushWhereToSql, queryColumnNameToKey, queryFrom, queryFromSql, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, quoteObjectKey, quoteSchemaAndTable, raw, rawSqlToCode, referencesArgsToCode, requirePrimaryKeys, resetDefaultNowFn, resolveSubQueryCallback, returnArg, rollbackSql, saveAliasedShape, searchSourcesToSql, selectAllSql, selectToSql, selectToSqlList, setColumnData, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setConnectRetryConfig, setCurrentColumnName, setDataValue, setDb, setDefaultLanguage, setDefaultNowFn, setDelayedRelation, setFreeAlias, setMoveMutativeQueryToCte, setObjectValueImmutable, setParserForSelectedString, setPrepareSubQueryForSql, setQueryObjectValueImmutable, setQueryOperators, setRawSqlPrepareSubQueryForSql, setSqlCtxSelectList, setTopCteSize, singleQuote, singleQuoteArray, snakeCaseKey, spreadObjectValues, sqlFn, sqlQueryArgsToExpression, stringDataToCode, stringMethodNames, tableDataMethods, templateLiteralSQLToCode, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, throwOnReadOnly, timestampHelpers, toArray, toCamelCase, toPascalCase, toSnakeCase, whereToSql, windowToSql, wrapAdapterFnWithConnectRetry };
|
package/dist/index.js
CHANGED
|
@@ -296,31 +296,6 @@ let prepareSubQueryForSql$2;
|
|
|
296
296
|
const setRawSqlPrepareSubQueryForSql = (fn) => {
|
|
297
297
|
prepareSubQueryForSql$2 = fn;
|
|
298
298
|
};
|
|
299
|
-
class RawSQLBase extends Expression {
|
|
300
|
-
constructor(_sql, _values) {
|
|
301
|
-
super();
|
|
302
|
-
this._sql = _sql;
|
|
303
|
-
this._values = _values;
|
|
304
|
-
this.q = { expr: this };
|
|
305
|
-
}
|
|
306
|
-
// Attach query variables to the raw SQL.
|
|
307
|
-
values(values) {
|
|
308
|
-
this._values = values;
|
|
309
|
-
return this;
|
|
310
|
-
}
|
|
311
|
-
// Convert raw SQL to code for a code generator.
|
|
312
|
-
toCode(t) {
|
|
313
|
-
const { _sql: sql, _values: values } = this;
|
|
314
|
-
let code = `${t}.sql`;
|
|
315
|
-
code += typeof sql === "string" ? `({ raw: '${sql.replace(/'/g, "\\'")}' })` : templateLiteralSQLToCode(sql);
|
|
316
|
-
if (values) {
|
|
317
|
-
code += `.values(${JSON.stringify(values)})`;
|
|
318
|
-
}
|
|
319
|
-
return code;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
RawSQLBase.prototype.type = ExpressionTypeMethod.prototype.type;
|
|
323
|
-
const isRawSQL = (arg) => arg instanceof RawSQLBase;
|
|
324
299
|
const used = [];
|
|
325
300
|
const literalValues = [];
|
|
326
301
|
const templateLiteralToSQL = (template, ctx, quotedAs) => {
|
|
@@ -342,14 +317,23 @@ const templateLiteralToSQL = (template, ctx, quotedAs) => {
|
|
|
342
317
|
}
|
|
343
318
|
return sql + parts[i];
|
|
344
319
|
};
|
|
345
|
-
class
|
|
320
|
+
class RawSql extends Expression {
|
|
346
321
|
constructor(sql, values, type) {
|
|
347
|
-
super(
|
|
322
|
+
super();
|
|
323
|
+
this.q = { expr: this };
|
|
324
|
+
this._sql = sql;
|
|
325
|
+
this._values = values;
|
|
348
326
|
this.result = { value: type };
|
|
349
327
|
if (type) {
|
|
350
328
|
Object.assign(this, type.operators);
|
|
351
329
|
}
|
|
352
330
|
}
|
|
331
|
+
// Attach query variables to the raw SQL.
|
|
332
|
+
values(values) {
|
|
333
|
+
this._values = values;
|
|
334
|
+
return this;
|
|
335
|
+
}
|
|
336
|
+
// Produce SQL string, push query variables into given `values` array.
|
|
353
337
|
makeSQL(ctx, quotedAs) {
|
|
354
338
|
let sql;
|
|
355
339
|
const isTemplate = typeof this._sql !== "string";
|
|
@@ -400,6 +384,17 @@ class RawSQL extends RawSQLBase {
|
|
|
400
384
|
return arr.join("'");
|
|
401
385
|
}
|
|
402
386
|
}
|
|
387
|
+
const isRawSQL = (arg) => arg instanceof RawSql;
|
|
388
|
+
RawSql.prototype.type = ExpressionTypeMethod.prototype.type;
|
|
389
|
+
const rawSqlToCode = (rawSql, t) => {
|
|
390
|
+
const { _sql: sql, _values: values } = rawSql;
|
|
391
|
+
let code = `${t}.sql`;
|
|
392
|
+
code += typeof sql === "string" ? `({ raw: '${sql.replace(/'/g, "\\'")}' })` : templateLiteralSQLToCode(sql);
|
|
393
|
+
if (values) {
|
|
394
|
+
code += `.values(${JSON.stringify(values)})`;
|
|
395
|
+
}
|
|
396
|
+
return code;
|
|
397
|
+
};
|
|
403
398
|
class DynamicRawSQL extends Expression {
|
|
404
399
|
constructor(fn) {
|
|
405
400
|
super();
|
|
@@ -421,24 +416,24 @@ class DynamicRawSQL extends Expression {
|
|
|
421
416
|
}
|
|
422
417
|
DynamicRawSQL.prototype.type = ExpressionTypeMethod.prototype.type;
|
|
423
418
|
function raw$1(...args) {
|
|
424
|
-
return isTemplateLiteralArgs(args) ? new
|
|
419
|
+
return isTemplateLiteralArgs(args) ? new RawSql(args) : typeof args[0] === "function" ? new DynamicRawSQL(args[0]) : new RawSql(args[0].raw, args[0].values);
|
|
425
420
|
}
|
|
426
|
-
const countSelect = [new
|
|
421
|
+
const countSelect = [new RawSql("count(*)")];
|
|
427
422
|
function sqlQueryArgsToExpression(args) {
|
|
428
|
-
return Array.isArray(args[0]) ? new
|
|
423
|
+
return Array.isArray(args[0]) ? new RawSql(args) : args[0];
|
|
429
424
|
}
|
|
430
425
|
const sqlFn = (...args) => {
|
|
431
426
|
const arg = args[0];
|
|
432
427
|
if (Array.isArray(arg)) {
|
|
433
|
-
return new
|
|
428
|
+
return new RawSql(args);
|
|
434
429
|
}
|
|
435
430
|
if (typeof args[0] === "string") {
|
|
436
|
-
return new
|
|
431
|
+
return new RawSql(args[0]);
|
|
437
432
|
}
|
|
438
433
|
if (args[1] !== void 0) {
|
|
439
|
-
return new
|
|
434
|
+
return new RawSql(args[1], arg);
|
|
440
435
|
}
|
|
441
|
-
return (...args2) => new
|
|
436
|
+
return (...args2) => new RawSql(args2, arg);
|
|
442
437
|
};
|
|
443
438
|
|
|
444
439
|
function makeColumnNullable(column, inputSchema, outputSchema, querySchema) {
|
|
@@ -1069,7 +1064,7 @@ const knownDefaults = {
|
|
|
1069
1064
|
};
|
|
1070
1065
|
const simplifyColumnDefault = (value) => {
|
|
1071
1066
|
if (typeof value === "string") {
|
|
1072
|
-
return new
|
|
1067
|
+
return new RawSql([
|
|
1073
1068
|
[knownDefaults[value.toLowerCase()] || value]
|
|
1074
1069
|
]);
|
|
1075
1070
|
}
|
|
@@ -1156,7 +1151,7 @@ const codeToString = (code, tabs, shift) => {
|
|
|
1156
1151
|
};
|
|
1157
1152
|
const columnDefaultArgumentToCode = (t, value) => {
|
|
1158
1153
|
if (typeof value === "object" && value && isRawSQL(value)) {
|
|
1159
|
-
return value
|
|
1154
|
+
return rawSqlToCode(value, t);
|
|
1160
1155
|
} else if (typeof value === "function") {
|
|
1161
1156
|
return value.toString();
|
|
1162
1157
|
} else if (typeof value === "string") {
|
|
@@ -1225,7 +1220,7 @@ const columnErrorMessagesToCode = (errors) => {
|
|
|
1225
1220
|
const isDefaultTimeStamp = (item) => {
|
|
1226
1221
|
if (item.dataType !== "timestamptz") return false;
|
|
1227
1222
|
const def = item.data.default;
|
|
1228
|
-
if (!(def
|
|
1223
|
+
if (!isRawSQL(def)) return false;
|
|
1229
1224
|
return typeof def._sql === "string" && def._sql.startsWith("now()");
|
|
1230
1225
|
};
|
|
1231
1226
|
const combineCodeElements = (input) => {
|
|
@@ -1452,7 +1447,7 @@ const constraintInnerToCode = (item, t, m) => {
|
|
|
1452
1447
|
];
|
|
1453
1448
|
}
|
|
1454
1449
|
return [
|
|
1455
|
-
`${t}.check(${item.check
|
|
1450
|
+
`${t}.check(${rawSqlToCode(item.check, t)}${item.name ? `, ${singleQuote(item.name)}` : ""})`
|
|
1456
1451
|
];
|
|
1457
1452
|
};
|
|
1458
1453
|
const referencesArgsToCode = ({
|
|
@@ -1574,7 +1569,7 @@ const columnExcludesToCode = (items) => {
|
|
|
1574
1569
|
};
|
|
1575
1570
|
const columnCheckToCode = (ctx, checks) => {
|
|
1576
1571
|
return checks.map(
|
|
1577
|
-
({ sql, name }) => `.check(${sql
|
|
1572
|
+
({ sql, name }) => `.check(${rawSqlToCode(sql, ctx.t)}${name ? `, '${name}'` : ""})`
|
|
1578
1573
|
).join("");
|
|
1579
1574
|
};
|
|
1580
1575
|
const identityToCode = (identity, dataType) => {
|
|
@@ -2974,7 +2969,7 @@ class TsQueryColumn extends Column {
|
|
|
2974
2969
|
}
|
|
2975
2970
|
}
|
|
2976
2971
|
const uuidDefaultSQL = "gen_random_uuid()";
|
|
2977
|
-
const uuidDefault = new
|
|
2972
|
+
const uuidDefault = new RawSql(uuidDefaultSQL);
|
|
2978
2973
|
class UUIDColumn extends Column {
|
|
2979
2974
|
constructor(schema) {
|
|
2980
2975
|
super(schema, schema.uuid());
|
|
@@ -3036,7 +3031,7 @@ class BooleanColumn extends Column {
|
|
|
3036
3031
|
}
|
|
3037
3032
|
const parseItem = (input) => input[0] === "t";
|
|
3038
3033
|
|
|
3039
|
-
class SimpleRawSQL extends
|
|
3034
|
+
class SimpleRawSQL extends RawSql {
|
|
3040
3035
|
// Simply returning SQL provided in the constructor.
|
|
3041
3036
|
makeSQL() {
|
|
3042
3037
|
return this._sql;
|
|
@@ -3300,7 +3295,7 @@ const makeColumnTypes = (schema) => {
|
|
|
3300
3295
|
...timestampHelpers
|
|
3301
3296
|
};
|
|
3302
3297
|
};
|
|
3303
|
-
|
|
3298
|
+
RawSql.prototype.columnTypes = makeColumnTypes;
|
|
3304
3299
|
|
|
3305
3300
|
class VirtualColumn extends Column {
|
|
3306
3301
|
constructor(schema, inputSchema = schema.never()) {
|
|
@@ -3323,7 +3318,7 @@ const _UnknownColumn = class _UnknownColumn extends VirtualColumn {
|
|
|
3323
3318
|
};
|
|
3324
3319
|
_UnknownColumn.instance = new _UnknownColumn(defaultSchemaConfig);
|
|
3325
3320
|
let UnknownColumn = _UnknownColumn;
|
|
3326
|
-
|
|
3321
|
+
RawSql.prototype.result = { value: UnknownColumn.instance };
|
|
3327
3322
|
|
|
3328
3323
|
const makeColumnsByType = (schema) => {
|
|
3329
3324
|
const t = makeColumnTypes(schema);
|
|
@@ -5542,7 +5537,7 @@ const noneMethods = {
|
|
|
5542
5537
|
const _queryNone = (q) => {
|
|
5543
5538
|
if (isQueryNone(q)) return q;
|
|
5544
5539
|
q = extendQuery(q, noneMethods);
|
|
5545
|
-
pushQueryValueImmutable(q, "and", new
|
|
5540
|
+
pushQueryValueImmutable(q, "and", new RawSql("false"));
|
|
5546
5541
|
pushQueryValueImmutable(
|
|
5547
5542
|
q,
|
|
5548
5543
|
"transform",
|
|
@@ -8129,7 +8124,7 @@ const collectNestedSelectBatches = (batches, rows, path, last) => {
|
|
|
8129
8124
|
}
|
|
8130
8125
|
}
|
|
8131
8126
|
};
|
|
8132
|
-
const emptyArrSQL = new
|
|
8127
|
+
const emptyArrSQL = new RawSql("'[]'");
|
|
8133
8128
|
const processSelectArg = (q, as, arg, columnAs) => {
|
|
8134
8129
|
const query = q;
|
|
8135
8130
|
if (typeof arg === "string") {
|
|
@@ -8733,7 +8728,7 @@ const getArgQueryTarget = (ctx, first, lateral, joinSubQuery, cloned) => {
|
|
|
8733
8728
|
const subJoinToSql = (ctx, jq, innerAs, lateral, outerAs, cloned) => {
|
|
8734
8729
|
if (!jq.q.select && jq.q.selectAllColumns) {
|
|
8735
8730
|
if (!cloned) jq = jq.clone();
|
|
8736
|
-
jq.q.select = [new
|
|
8731
|
+
jq.q.select = [new RawSql(`${innerAs}.*`)];
|
|
8737
8732
|
}
|
|
8738
8733
|
const sql = `(${moveMutativeQueryToCte(ctx, jq)}) ${outerAs || innerAs}`;
|
|
8739
8734
|
return lateral ? `LATERAL ${sql}` : sql;
|
|
@@ -9253,7 +9248,7 @@ const pushSubQuerySql = (ctx, mainQuery, query, as, list, quotedAs, aliases) =>
|
|
|
9253
9248
|
cloned,
|
|
9254
9249
|
cloned.baseQuery.clone()
|
|
9255
9250
|
);
|
|
9256
|
-
_queryGetOptional(query, new
|
|
9251
|
+
_queryGetOptional(query, new RawSql(`COALESCE(json_agg("c"), '[]')`));
|
|
9257
9252
|
}
|
|
9258
9253
|
break;
|
|
9259
9254
|
}
|
|
@@ -9721,7 +9716,7 @@ const makeInsertSql = (ctx, q, query, quotedAs, isSubSql) => {
|
|
|
9721
9716
|
pushQueryValueImmutable(
|
|
9722
9717
|
q2,
|
|
9723
9718
|
"select",
|
|
9724
|
-
new
|
|
9719
|
+
new RawSql(
|
|
9725
9720
|
encodeRow(
|
|
9726
9721
|
ctx,
|
|
9727
9722
|
ctx.values,
|
|
@@ -10658,6 +10653,20 @@ const pushUnionSql = (ctx, union, quotedAs) => {
|
|
|
10658
10653
|
}
|
|
10659
10654
|
};
|
|
10660
10655
|
|
|
10656
|
+
const pushForSql = (ctx, q, type, quotedAs) => {
|
|
10657
|
+
if (q.for && (type !== "upsert" || !q.upsertSecond)) {
|
|
10658
|
+
ctx.sql.push("FOR", q.for.type);
|
|
10659
|
+
const { tableNames } = q.for;
|
|
10660
|
+
if (tableNames) {
|
|
10661
|
+
ctx.sql.push(
|
|
10662
|
+
"OF",
|
|
10663
|
+
isExpression(tableNames) ? tableNames.toSQL(ctx, quotedAs) : tableNames.map((x) => `"${x}"`).join(", ")
|
|
10664
|
+
);
|
|
10665
|
+
}
|
|
10666
|
+
if (q.for.mode) ctx.sql.push(q.for.mode);
|
|
10667
|
+
}
|
|
10668
|
+
};
|
|
10669
|
+
|
|
10661
10670
|
const toSql = (table, type, topCtx, isSubSql, cteName) => {
|
|
10662
10671
|
const query = table.q;
|
|
10663
10672
|
const sql = [];
|
|
@@ -10712,6 +10721,7 @@ const toSql = (table, type, topCtx, isSubSql, cteName) => {
|
|
|
10712
10721
|
let runAfterQuery;
|
|
10713
10722
|
let skipSelect;
|
|
10714
10723
|
if (type === "upsert") {
|
|
10724
|
+
const upsertUpdate = query.upsertUpdate && query.updateData;
|
|
10715
10725
|
if (isSubSql || query.upsertSecond) {
|
|
10716
10726
|
skipSelect = true;
|
|
10717
10727
|
const upsertOrCreate = _clone(table);
|
|
@@ -10719,7 +10729,7 @@ const toSql = (table, type, topCtx, isSubSql, cteName) => {
|
|
|
10719
10729
|
toSql,
|
|
10720
10730
|
ctx,
|
|
10721
10731
|
upsertOrCreate,
|
|
10722
|
-
|
|
10732
|
+
upsertUpdate ? "update" : null
|
|
10723
10733
|
);
|
|
10724
10734
|
upsertOrCreate.q.and = upsertOrCreate.q.or = upsertOrCreate.q.scopes = void 0;
|
|
10725
10735
|
_queryWhereNotExists(
|
|
@@ -10753,7 +10763,7 @@ const toSql = (table, type, topCtx, isSubSql, cteName) => {
|
|
|
10753
10763
|
second.q.upsertSecond = void 0;
|
|
10754
10764
|
});
|
|
10755
10765
|
};
|
|
10756
|
-
if (
|
|
10766
|
+
if (upsertUpdate) {
|
|
10757
10767
|
const result2 = toSql(table, "update", topCtx, isSubSql);
|
|
10758
10768
|
if ("text" in result2) {
|
|
10759
10769
|
result2.runAfterQuery = runAfterQuery;
|
|
@@ -10820,17 +10830,7 @@ const toSql = (table, type, topCtx, isSubSql, cteName) => {
|
|
|
10820
10830
|
pushOrderBySql(ctx, query, quotedAs, query.order);
|
|
10821
10831
|
}
|
|
10822
10832
|
pushLimitOffsetSql(ctx, query, fromQuery);
|
|
10823
|
-
|
|
10824
|
-
sql.push("FOR", query.for.type);
|
|
10825
|
-
const { tableNames } = query.for;
|
|
10826
|
-
if (tableNames) {
|
|
10827
|
-
sql.push(
|
|
10828
|
-
"OF",
|
|
10829
|
-
isExpression(tableNames) ? tableNames.toSQL(ctx, quotedAs) : tableNames.map((x) => `"${x}"`).join(", ")
|
|
10830
|
-
);
|
|
10831
|
-
}
|
|
10832
|
-
if (query.for.mode) sql.push(query.for.mode);
|
|
10833
|
-
}
|
|
10833
|
+
pushForSql(ctx, query, type, quotedAs);
|
|
10834
10834
|
addTableHook(ctx, table, query, query.hookSelect);
|
|
10835
10835
|
if (selectSqlPos !== void 0 && ctx.selectList?.length) {
|
|
10836
10836
|
sql[selectSqlPos] += " " + ctx.selectList.join(", ");
|
|
@@ -11400,9 +11400,9 @@ class AggregateMethods {
|
|
|
11400
11400
|
* ```
|
|
11401
11401
|
*/
|
|
11402
11402
|
exists() {
|
|
11403
|
-
const q = _queryGetOptional(_clone(this), new
|
|
11403
|
+
const q = _queryGetOptional(_clone(this), new RawSql("true"));
|
|
11404
11404
|
q.q.notFoundDefault = false;
|
|
11405
|
-
q.q.coalesceValue = new
|
|
11405
|
+
q.q.coalesceValue = new RawSql("false");
|
|
11406
11406
|
return q;
|
|
11407
11407
|
}
|
|
11408
11408
|
/**
|
|
@@ -13958,9 +13958,9 @@ function enableSoftDelete(query, table, shape, softDelete, scopes) {
|
|
|
13958
13958
|
return _del.call(_clone(this));
|
|
13959
13959
|
};
|
|
13960
13960
|
}
|
|
13961
|
-
const nowSql = new
|
|
13961
|
+
const nowSql = new RawSql("now()");
|
|
13962
13962
|
const _softDelete = (column, customNowSQL) => {
|
|
13963
|
-
const set = { [column]: customNowSQL ? new
|
|
13963
|
+
const set = { [column]: customNowSQL ? new RawSql(customNowSQL) : nowSql };
|
|
13964
13964
|
return function() {
|
|
13965
13965
|
return _queryUpdate(this, set);
|
|
13966
13966
|
};
|
|
@@ -15423,8 +15423,7 @@ exports.QueryScope = QueryScope;
|
|
|
15423
15423
|
exports.QuerySql = QuerySql;
|
|
15424
15424
|
exports.QueryTransform = QueryTransform;
|
|
15425
15425
|
exports.QueryWrap = QueryWrap;
|
|
15426
|
-
exports.
|
|
15427
|
-
exports.RawSQLBase = RawSQLBase;
|
|
15426
|
+
exports.RawSql = RawSql;
|
|
15428
15427
|
exports.RealColumn = RealColumn;
|
|
15429
15428
|
exports.RefExpression = RefExpression;
|
|
15430
15429
|
exports.Select = Select;
|
|
@@ -15675,6 +15674,7 @@ exports.queryWrap = queryWrap;
|
|
|
15675
15674
|
exports.quoteObjectKey = quoteObjectKey;
|
|
15676
15675
|
exports.quoteSchemaAndTable = quoteSchemaAndTable;
|
|
15677
15676
|
exports.raw = raw$1;
|
|
15677
|
+
exports.rawSqlToCode = rawSqlToCode;
|
|
15678
15678
|
exports.referencesArgsToCode = referencesArgsToCode;
|
|
15679
15679
|
exports.requirePrimaryKeys = requirePrimaryKeys;
|
|
15680
15680
|
exports.resetDefaultNowFn = resetDefaultNowFn;
|