pqb 0.68.1 → 0.70.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/dist/index.d.ts +245 -212
- package/dist/index.js +587 -545
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +587 -545
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.ts +238 -206
- package/dist/node-postgres.js +9 -15
- package/dist/node-postgres.js.map +1 -1
- package/dist/node-postgres.mjs +9 -15
- package/dist/node-postgres.mjs.map +1 -1
- package/dist/postgres-js.js +64 -0
- package/dist/postgres-js.js.map +1 -1
- package/dist/postgres-js.mjs +64 -0
- package/dist/postgres-js.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Adapter, AdapterClass, AdapterConfigBase, AdapterParams, AdapterSchemaConfigOptions, AfterCommitStandaloneHook, AfterHook, ArrayColumn, ArrayColumnValue, ArrayData, AsyncState, BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Code, Codes, Column, ColumnFromDbParams, ColumnSchemaConfig, ColumnSchemaGetterColumns, ColumnSchemaGetterTableClass, ColumnToCodeCtx, ColumnTypeSchemaArg, ColumnsByType, ColumnsShape, ComputedColumnsFromOptions, ComputedOptionsConfig, ComputedOptionsFactory, CreateCtx, CreateData, CreateManyMethodsNames, CreateMethodsNames, CreateSelf, CustomTypeColumn, DateColumn, DateColumnData, DbDomainArg, DbExtension, DbOptions, DbResult, DbSharedOptions, DbSqlMethod, DbStructureDomainsMap, DbTableOptionScopes, DbTableOptions, DecimalColumn, DecimalColumnData, DefaultColumnTypes, DefaultPrivileges, DefaultSchemaConfig, DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, DriverAdapter, DynamicRawSQL, EmptyObject, EmptyTuple, EnumColumn, Expression, ExpressionData, FromArg, FromResult, GeneratorIgnore, HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, IsQuery, IsolationLevel, JSONColumn, JSONTextColumn,
|
|
1
|
+
import { Adapter, AdapterClass, AdapterConfigBase, AdapterParams, AdapterSchemaConfigOptions, AfterCommitStandaloneHook, AfterHook, ArrayColumn, ArrayColumnValue, ArrayData, AsyncState, BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Code, Codes, Column, ColumnFromDbParams, ColumnSchemaConfig, ColumnSchemaGetterColumns, ColumnSchemaGetterTableClass, ColumnToCodeCtx, ColumnTypeSchemaArg, ColumnsByType, ColumnsShape, ComputedColumnsFromOptions, ComputedOptionsConfig, ComputedOptionsFactory, CreateCtx, CreateData, CreateManyMethodsNames, CreateMethodsNames, CreateSelf, CustomTypeColumn, DateColumn, DateColumnData, DbDomainArg, DbExtension, DbOptions, DbResult, DbSharedOptions, DbSqlMethod, DbStructureDomainsMap, DbTableOptionScopes, DbTableOptions, DecimalColumn, DecimalColumnData, DefaultColumnTypes, DefaultPrivileges, DefaultSchemaConfig, DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, DriverAdapter, DynamicRawSQL, EmptyObject, EmptyTuple, EnumColumn, Expression, ExpressionData, FromArg, FromResult, GeneratorIgnore, HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, IsQuery, IsolationLevel, JSONColumn, JSONTextColumn, JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MapTableScopesOption, MaybeArray, MaybePromise, MergeQuery, MoneyColumn, NoPrimaryKeyOption, NonUniqDataItem, NumberColumnData, Operators, OperatorsArray, OperatorsJson, OperatorsOrdinalText, OperatorsText, Ord, PathColumn, PickQueryInputType, PickQueryInternal, PickQueryQ, PickQueryRelations, PickQuerySelectableRelations, PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, QueryAfterHook, QueryBeforeActionHook, QueryBeforeHook, QueryData, QueryHasWhere, QueryHookUtils, QueryHooks, QueryInternal, QueryLogObject, QueryLogOptions, QueryLogger, QueryManyTake, QueryManyTakeOptional, QueryOrExpression, QueryResult, QueryResultRow, QueryReturnType, QuerySchema, QueryScopes, RawSql, RawSqlBase, RealColumn, RecordKeyTrue, RecordOptionalString, RecordString, RecordStringOrNumber, RecordUnknown, RelationConfigBase, RelationJoinQuery, RelationsBase, Rls, RlsPolicy, SchemaConfigFnWithOptions, SearchWeight, SelectableFromShape, SerialColumn, SerialColumnData, ShallowSimplify, ShapeUniqueColumns, SingleSql, SingleSqlItem, SmallIntColumn, SmallSerialColumn, Sql, SqlFn, SqlSessionState, StorageOptions, StringColumn, StringData, TableData, TableDataFn, TableDataInput, TableDataItem, TableDataItemsUniqueColumnTuples, TableDataItemsUniqueColumns, TableDataItemsUniqueConstraints, TableDataMethods, TemplateLiteralArgs, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, Timestamps, ToSQLCtx, ToSqlValues, TransactionAdapter, TransactionAdapterClass, TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, UniqueConstraints, UniqueTableDataItem, UnknownColumn, UpdateData, UpsertData, UpsertThis, VarCharColumn, VirtualColumn, WhereArg, XMLColumn, _appendQuery, _appendQueryOnUpsertCreate, _clone, _createDbSqlMethod, _hookSelectColumns, _initQueryBuilder, _orCreate, _prependWith, _queryCreate, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterUpdate, _queryInsert, _queryInsertMany, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, internalSchemaConfig, isExpression, isQueryReturnsAll, isRawSQL, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeConnectRetryConfig, noop, objectHasValues, omit, parseTableData, parseTableDataInput, pathToLog, pick, pluralize, prepareSubQueryForSql, primaryKeyInnerToCode, pushQueryOnForOuter, pushQueryValueImmutable, pushTableDataCode, queryToSql, quoteIdentifier, quoteObjectKey, quoteTableWithSchema, raw, rawSqlToCode, rawSqlToSql, referencesArgsToCode, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry } from "./index.d.ts";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
interface RelationJoinQuery$1 {
|
|
4
4
|
(joiningQuery: IsQuery$1, baseQuery: IsQuery$1): IsQuery$1;
|
|
@@ -1645,6 +1645,8 @@ declare class BooleanColumn$1<Schema extends ColumnSchemaConfig$1> extends Colum
|
|
|
1645
1645
|
querySchema: ReturnType<Schema['boolean']>;
|
|
1646
1646
|
private static _instance;
|
|
1647
1647
|
static get instance(): BooleanColumn$1<DefaultSchemaConfig$1>;
|
|
1648
|
+
private static _instanceSkipValueToArray;
|
|
1649
|
+
static get instanceSkipValueToArray(): BooleanColumn$1<DefaultSchemaConfig$1>;
|
|
1648
1650
|
constructor(schema: Schema);
|
|
1649
1651
|
toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
|
|
1650
1652
|
}
|
|
@@ -2150,21 +2152,23 @@ declare class UnsafeSqlExpression extends Expression$1 {
|
|
|
2150
2152
|
constructor(sql: string | number | boolean);
|
|
2151
2153
|
makeSQL(): string;
|
|
2152
2154
|
}
|
|
2153
|
-
type getValueKey = typeof getValueKey;
|
|
2154
|
-
declare const getValueKey: unique symbol;
|
|
2155
2155
|
interface PickQueryDataParsers {
|
|
2156
2156
|
defaultParsers?: ColumnsParsers;
|
|
2157
2157
|
parsers?: ColumnsParsers;
|
|
2158
2158
|
batchParsers?: BatchParsers;
|
|
2159
2159
|
}
|
|
2160
2160
|
type ColumnParser = FnUnknownToUnknown;
|
|
2161
|
+
interface BatchParserPathEntry {
|
|
2162
|
+
key: string;
|
|
2163
|
+
returnType: QueryReturnType$1;
|
|
2164
|
+
}
|
|
2161
2165
|
interface BatchParser {
|
|
2162
|
-
path:
|
|
2163
|
-
fn: (path:
|
|
2166
|
+
path: BatchParserPathEntry[];
|
|
2167
|
+
fn: (path: BatchParserPathEntry[], queryResult: {
|
|
2164
2168
|
rows: unknown[];
|
|
2165
2169
|
}) => MaybePromise$1<void>;
|
|
2166
2170
|
}
|
|
2167
|
-
type ColumnsParsers = { [K in string
|
|
2171
|
+
type ColumnsParsers = { [K in string]?: ColumnParser };
|
|
2168
2172
|
type BatchParsers = BatchParser[];
|
|
2169
2173
|
interface QueryThen<T> {
|
|
2170
2174
|
<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
|
@@ -3160,169 +3164,6 @@ interface AggregateOptions<T extends PickQuerySelectableResultRelationsWindows>
|
|
|
3160
3164
|
over?: Over<T>;
|
|
3161
3165
|
}
|
|
3162
3166
|
type Over<T extends PickQuerySelectableResultWindows> = keyof T['windows'] | WindowArgDeclaration<T>;
|
|
3163
|
-
interface ColumnsShape$1 {
|
|
3164
|
-
[K: string]: Column$1;
|
|
3165
|
-
}
|
|
3166
|
-
declare namespace ColumnsShape$1 {
|
|
3167
|
-
export type DefaultSelectKeys<S extends Column$1.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof S];
|
|
3168
|
-
export type DefaultOutput<Set extends Column$1.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['__outputType'] };
|
|
3169
|
-
export type Input<Shape extends Column$1.QueryColumnsInit, AppReadOnly = { [K in keyof Shape]: Shape[K]['data']['appReadOnly'] extends true ? K : never }[keyof Shape], Optional extends keyof Shape = { [K in keyof Shape]: Shape[K]['data']['optional'] extends true ? K : never }[keyof Shape]> = { [K in Exclude<keyof Shape, AppReadOnly | Optional>]: Shape[K]['__inputType'] } & { [K in Exclude<Optional, AppReadOnly>]?: Shape[K]['__inputType'] };
|
|
3170
|
-
export type InputPartial<Shape extends Column$1.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['__inputType'] };
|
|
3171
|
-
export type Output<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
|
|
3172
|
-
export type DefaultSelectOutput<Shape extends Column$1.QueryColumnsInit> = { [K in { [K in keyof Shape]: Shape[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof Shape]]: Shape[K]['__outputType'] };
|
|
3173
|
-
export interface MapToObjectColumn<Shape extends Column$1.QueryColumns> {
|
|
3174
|
-
dataType: 'object';
|
|
3175
|
-
__type: { [K in keyof Shape]: Shape[K]['__type'] };
|
|
3176
|
-
__outputType: ShallowSimplify$1<ObjectOutput<Shape>>;
|
|
3177
|
-
__queryType: { [K in keyof Shape]: Shape[K]['__queryType'] };
|
|
3178
|
-
operators: OperatorsAny;
|
|
3179
|
-
}
|
|
3180
|
-
export interface MapToNullableObjectColumn<Shape extends Column$1.QueryColumns> {
|
|
3181
|
-
dataType: 'object';
|
|
3182
|
-
__type: { [K in keyof Shape]: Shape[K]['__type'] };
|
|
3183
|
-
__outputType: ShallowSimplify$1<ObjectOutput<Shape>> | undefined;
|
|
3184
|
-
__queryType: { [K in keyof Shape]: Shape[K]['__queryType'] } | null;
|
|
3185
|
-
operators: OperatorsAny;
|
|
3186
|
-
}
|
|
3187
|
-
export interface MapToPluckColumn<Shape extends Column$1.QueryColumns> {
|
|
3188
|
-
dataType: 'array';
|
|
3189
|
-
__type: Shape['pluck']['__type'][];
|
|
3190
|
-
__outputType: Shape['pluck']['__outputType'][];
|
|
3191
|
-
__queryType: Shape['pluck']['__queryType'][];
|
|
3192
|
-
operators: OperatorsAny;
|
|
3193
|
-
}
|
|
3194
|
-
export interface MapToObjectArrayColumn<Shape extends Column$1.QueryColumns> {
|
|
3195
|
-
dataType: 'array';
|
|
3196
|
-
__type: { [K in keyof Shape]: Shape[K]['__type'] }[];
|
|
3197
|
-
__outputType: ShallowSimplify$1<ObjectOutput<Shape>>[];
|
|
3198
|
-
__queryType: { [K in keyof Shape]: Shape[K]['__queryType'] }[];
|
|
3199
|
-
operators: OperatorsAny;
|
|
3200
|
-
}
|
|
3201
|
-
type ObjectOutput<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
|
|
3202
|
-
export {};
|
|
3203
|
-
}
|
|
3204
|
-
interface SelectSelf extends PickQuerySelectable, PickQueryHasSelect, PickQueryDefaultSelect, PickQueryShape$1, PickQueryRelations$1, PickQueryResult, PickQueryReturnType, PickQueryWithData {}
|
|
3205
|
-
type SelectArgs<T extends SelectSelf> = ('*' | keyof T['__selectable'])[];
|
|
3206
|
-
interface SubQueryAddition<T extends PickQueryWithData> extends IsSubQuery {
|
|
3207
|
-
withData: T['withData'];
|
|
3208
|
-
}
|
|
3209
|
-
type SelectAsFnArg<T extends PickQueryRelationsWithData> = EmptyObject$1 extends T['relations'] ? T : { [K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? RelationQueryMaybeSingle<T['relations'][K]> & SubQueryAddition<T> : K extends keyof T ? T[K] : never };
|
|
3210
|
-
interface SelectAsArg<T extends SelectSelf> {
|
|
3211
|
-
[K: string]: keyof T['__selectable'] | Expression$1 | ((q: SelectAsFnArg<T>) => unknown);
|
|
3212
|
-
}
|
|
3213
|
-
type SelectAsFnReturnType = {
|
|
3214
|
-
result: Column$1.QueryColumns;
|
|
3215
|
-
returnType: Exclude<QueryReturnType$1, 'rows'>;
|
|
3216
|
-
} | Expression$1;
|
|
3217
|
-
interface SelectAsCheckReturnTypes {
|
|
3218
|
-
[K: string]: PropertyKey | Expression$1 | ((q: never) => SelectAsFnReturnType);
|
|
3219
|
-
}
|
|
3220
|
-
type SelectReturnType<T extends PickQueryReturnType> = T['returnType'] extends 'valueOrThrow' ? 'oneOrThrow' : T extends 'value' ? 'one' : T['returnType'] extends 'pluck' ? 'all' : T['returnType'];
|
|
3221
|
-
type SelectResult<T extends SelectSelf, Columns extends PropertyKey[]> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
|
|
3222
|
-
type SelectResultObj<T extends SelectSelf, Obj> = Obj extends SelectAsCheckReturnTypes ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? { [K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never } : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never }> : T[K] } : `Invalid return type of ${{ [K in keyof Obj]: Obj[K] extends ((...args: any[]) => any) ? ReturnType<Obj[K]> extends SelectAsFnReturnType ? never : K : never }[keyof Obj] & string}`;
|
|
3223
|
-
type SelectResultColumnsAndObj<T extends SelectSelf, Columns extends PropertyKey[], Obj> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? // Combine previously selected items, all columns if * was provided,
|
|
3224
|
-
{ [K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
|
|
3225
|
-
interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
|
|
3226
|
-
result: Column$1.QueryColumns;
|
|
3227
|
-
returnType: 'value' | 'valueOrThrow' | 'one' | 'oneOrThrow';
|
|
3228
|
-
}
|
|
3229
|
-
type SelectAsSelectable<Obj> = UnionToIntersection<{ [K in keyof Obj]: Obj[K] extends ((q: never) => infer R extends AllowedRelationOneQueryForSelectable) ? { [C in R['returnType'] extends 'value' | 'valueOrThrow' ? K : keyof R['result'] as R['returnType'] extends 'value' | 'valueOrThrow' ? K : `${K & string}.${C & string}`]: {
|
|
3230
|
-
as: C;
|
|
3231
|
-
column: R['returnType'] extends 'value' | 'valueOrThrow' ? R['result']['value'] : R['result'][C & keyof R['result']];
|
|
3232
|
-
} } : never }[keyof Obj]>;
|
|
3233
|
-
type SelectAsValueResult<T extends SelectSelf, Arg> = Arg extends keyof T['__selectable'] ? T['__selectable'][Arg]['column'] : Arg extends Expression$1 ? Arg['result']['value'] : Arg extends ((q: never) => IsQuery$1) ? SelectSubQueryResult<ReturnType<Arg>> : Arg extends ((q: never) => Expression$1) ? ReturnType<Arg>['result']['value'] : Arg extends ((q: never) => IsQuery$1 | Expression$1) ? SelectSubQueryResult<Exclude<ReturnType<Arg>, Expression$1>> | Exclude<ReturnType<Arg>, IsQuery$1>['result']['value'] : never;
|
|
3234
|
-
type SelectSubQueryResult<Arg extends SelectSelf> = Arg['returnType'] extends undefined | 'all' ? ColumnsShape$1.MapToObjectArrayColumn<Arg['result']> : Arg['returnType'] extends 'value' | 'valueOrThrow' ? Arg['result']['value'] : Arg['returnType'] extends 'pluck' ? ColumnsShape$1.MapToPluckColumn<Arg['result']> : Arg['returnType'] extends 'one' ? ColumnsShape$1.MapToNullableObjectColumn<Arg['result']> : ColumnsShape$1.MapToObjectColumn<Arg['result']>;
|
|
3235
|
-
declare class Select {
|
|
3236
|
-
/**
|
|
3237
|
-
* Takes a list of columns to be selected, and by default, the query builder will select all columns of the table.
|
|
3238
|
-
*
|
|
3239
|
-
* The last argument can be an object. Keys of the object are column aliases, value can be a column name, sub-query, or raw SQL expression.
|
|
3240
|
-
*
|
|
3241
|
-
* ```ts
|
|
3242
|
-
* import { sql } from './baseTable'
|
|
3243
|
-
*
|
|
3244
|
-
* // select columns of the table:
|
|
3245
|
-
* db.table.select('id', 'name', { idAlias: 'id' });
|
|
3246
|
-
*
|
|
3247
|
-
* // accepts columns with table names:
|
|
3248
|
-
* db.table.select('user.id', 'user.name', { nameAlias: 'user.name' });
|
|
3249
|
-
*
|
|
3250
|
-
* // table name may refer to the current table or a joined table:
|
|
3251
|
-
* db.table
|
|
3252
|
-
* .join(db.message, 'authorId', 'user.id')
|
|
3253
|
-
* .select('user.name', 'message.text', { textAlias: 'message.text' });
|
|
3254
|
-
*
|
|
3255
|
-
* // select value from the sub-query,
|
|
3256
|
-
* // this sub-query should return a single record and a single column:
|
|
3257
|
-
* db.table.select({
|
|
3258
|
-
* subQueryResult: Otherdb.table.select('column').take(),
|
|
3259
|
-
* });
|
|
3260
|
-
*
|
|
3261
|
-
* // select raw SQL value, specify the returning type via <generic> syntax:
|
|
3262
|
-
* db.table.select({
|
|
3263
|
-
* raw: sql<number>`1 + 2`,
|
|
3264
|
-
* });
|
|
3265
|
-
*
|
|
3266
|
-
* // select raw SQL value, the resulting type can be set by providing a column type in such way:
|
|
3267
|
-
* db.table.select({
|
|
3268
|
-
* raw: sql`1 + 2`.type((t) => t.integer()),
|
|
3269
|
-
* });
|
|
3270
|
-
*
|
|
3271
|
-
* // same raw SQL query as above, but the sql is returned from a callback
|
|
3272
|
-
* db.table.select({
|
|
3273
|
-
* raw: () => sql`1 + 2`.type((t) => t.integer()),
|
|
3274
|
-
* });
|
|
3275
|
-
* ```
|
|
3276
|
-
*
|
|
3277
|
-
* When you use the ORM and defined relations, `select` can also accept callbacks with related table queries:
|
|
3278
|
-
*
|
|
3279
|
-
* ```ts
|
|
3280
|
-
* await db.author.select({
|
|
3281
|
-
* allBooks: (q) => q.books,
|
|
3282
|
-
* firstBook: (q) => q.books.order({ createdAt: 'ASC' }).take(),
|
|
3283
|
-
* booksCount: (q) => q.books.count(),
|
|
3284
|
-
* });
|
|
3285
|
-
* ```
|
|
3286
|
-
*
|
|
3287
|
-
* When you're selecting a relation that's connected via `belongsTo` or `hasOne`, it becomes available to use in `order` or in `where`:
|
|
3288
|
-
*
|
|
3289
|
-
* ```ts
|
|
3290
|
-
* // select books with their authors included, order by author name and filter by author column:
|
|
3291
|
-
* await db.books
|
|
3292
|
-
* .select({
|
|
3293
|
-
* author: (q) => q.author,
|
|
3294
|
-
* })
|
|
3295
|
-
* .order('author.name')
|
|
3296
|
-
* .where({ 'author.isPopular': true });
|
|
3297
|
-
* ```
|
|
3298
|
-
*/
|
|
3299
|
-
select<T extends SelectSelf, Columns extends SelectArgs<T>>(this: T, ...args: Columns): SelectResult<T, Columns>;
|
|
3300
|
-
select<T extends SelectSelf, Obj extends SelectAsArg<T>>(this: T, obj: Obj): SelectResultObj<T, Obj>;
|
|
3301
|
-
select<T extends SelectSelf, Columns extends SelectArgs<T>, Obj extends SelectAsArg<T>>(this: T, ...args: [...columns: Columns, obj: Obj]): SelectResultColumnsAndObj<T, Columns, Obj>;
|
|
3302
|
-
/**
|
|
3303
|
-
* When querying the table or creating records, all columns are selected by default,
|
|
3304
|
-
* but updating and deleting queries are returning affected row counts by default.
|
|
3305
|
-
*
|
|
3306
|
-
* Use `selectAll` to select all columns. If the `.select` method was applied before it will be discarded.
|
|
3307
|
-
*
|
|
3308
|
-
* ```ts
|
|
3309
|
-
* const selectFull = await db.table
|
|
3310
|
-
* .select('id', 'name') // discarded by `selectAll`
|
|
3311
|
-
* .selectAll();
|
|
3312
|
-
*
|
|
3313
|
-
* const updatedFull = await db.table.selectAll().where(conditions).update(data);
|
|
3314
|
-
*
|
|
3315
|
-
* const deletedFull = await db.table.selectAll().where(conditions).delete();
|
|
3316
|
-
* ```
|
|
3317
|
-
*/
|
|
3318
|
-
selectAll<T extends SelectSelf>(this: T): SelectResult<T, ['*']>;
|
|
3319
|
-
}
|
|
3320
|
-
interface QueryGetSelf extends PickQuerySelectable, PickQueryRelationsWithData {}
|
|
3321
|
-
type GetArg<T extends QueryGetSelf> = GetStringArg<T> | Expression$1 | ((q: SelectAsFnArg<T>) => Expression$1 | Query.Pick.SingleValueResult);
|
|
3322
|
-
type GetStringArg<T extends PickQuerySelectable> = keyof T['__selectable'] & string;
|
|
3323
|
-
type ResolveGetArgColumn<Arg> = Arg extends Expression$1 ? Arg['result']['value'] : Arg extends ((q: never) => infer R) ? R extends Expression$1 ? R['result']['value'] : R extends Query.Pick.SingleValueResult ? R['result']['value'] : never : never;
|
|
3324
|
-
type GetResult<T extends QueryGetSelf, Arg extends GetArg<T>> = Arg extends string ? SetQueryReturnsValueOrThrow<T, Arg> : SetQueryReturnsColumnOrThrow<T, ResolveGetArgColumn<Arg>>;
|
|
3325
|
-
type GetResultOptional<T extends QueryGetSelf, Arg extends GetArg<T>> = Arg extends string ? SetQueryReturnsValueOptional<T, Arg> : SetQueryReturnsColumnOptional<T, ResolveGetArgColumn<Arg>>;
|
|
3326
3167
|
type HeadlineSearchArg<T extends PickQueryTsQuery> = Exclude<T['__tsQuery'], undefined>;
|
|
3327
3168
|
interface HeadlineParams<T extends PickQuerySelectable> {
|
|
3328
3169
|
text?: SelectableOrExpressionOfType<T, Column$1.Pick.QueryColumnOfType<string>>;
|
|
@@ -3659,16 +3500,6 @@ interface AggregateArgTypes {
|
|
|
3659
3500
|
}
|
|
3660
3501
|
interface AggregateMethods extends SearchAggregateMethods {}
|
|
3661
3502
|
declare class AggregateMethods {
|
|
3662
|
-
/**
|
|
3663
|
-
* Use `exists()` to check if there is at least one record-matching condition.
|
|
3664
|
-
*
|
|
3665
|
-
* It will discard previous `select` statements if any. Returns a boolean.
|
|
3666
|
-
*
|
|
3667
|
-
* ```ts
|
|
3668
|
-
* const exists: boolean = await db.table.where(...conditions).exists();
|
|
3669
|
-
* ```
|
|
3670
|
-
*/
|
|
3671
|
-
exists<T extends QueryGetSelf>(this: T): SetQueryReturnsColumnOrThrow<T, BooleanQueryColumn>;
|
|
3672
3503
|
/**
|
|
3673
3504
|
* Count records with the `count` function:
|
|
3674
3505
|
*
|
|
@@ -5264,6 +5095,7 @@ interface ExpressionData$1 extends HasBeforeAndBeforeSet {
|
|
|
5264
5095
|
expr?: Expression$1;
|
|
5265
5096
|
before?: QueryBeforeHook$1[];
|
|
5266
5097
|
dynamicBefore?: boolean;
|
|
5098
|
+
getColumn?: Column$1;
|
|
5267
5099
|
}
|
|
5268
5100
|
declare abstract class Expression$1<T extends Column$1.Pick.QueryColumn = Column$1.Pick.QueryColumn> {
|
|
5269
5101
|
abstract result: {
|
|
@@ -5818,6 +5650,169 @@ declare class FromMethods {
|
|
|
5818
5650
|
*/
|
|
5819
5651
|
only<T>(this: T, only?: boolean): T;
|
|
5820
5652
|
}
|
|
5653
|
+
interface ColumnsShape$1 {
|
|
5654
|
+
[K: string]: Column$1;
|
|
5655
|
+
}
|
|
5656
|
+
declare namespace ColumnsShape$1 {
|
|
5657
|
+
export type DefaultSelectKeys<S extends Column$1.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof S];
|
|
5658
|
+
export type DefaultOutput<Set extends Column$1.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['__outputType'] };
|
|
5659
|
+
export type Input<Shape extends Column$1.QueryColumnsInit, AppReadOnly = { [K in keyof Shape]: Shape[K]['data']['appReadOnly'] extends true ? K : never }[keyof Shape], Optional extends keyof Shape = { [K in keyof Shape]: Shape[K]['data']['optional'] extends true ? K : never }[keyof Shape]> = { [K in Exclude<keyof Shape, AppReadOnly | Optional>]: Shape[K]['__inputType'] } & { [K in Exclude<Optional, AppReadOnly>]?: Shape[K]['__inputType'] };
|
|
5660
|
+
export type InputPartial<Shape extends Column$1.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['__inputType'] };
|
|
5661
|
+
export type Output<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
|
|
5662
|
+
export type DefaultSelectOutput<Shape extends Column$1.QueryColumnsInit> = { [K in { [K in keyof Shape]: Shape[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof Shape]]: Shape[K]['__outputType'] };
|
|
5663
|
+
export interface MapToObjectColumn<Shape extends Column$1.QueryColumns> {
|
|
5664
|
+
dataType: 'object';
|
|
5665
|
+
__type: { [K in keyof Shape]: Shape[K]['__type'] };
|
|
5666
|
+
__outputType: ShallowSimplify$1<ObjectOutput<Shape>>;
|
|
5667
|
+
__queryType: { [K in keyof Shape]: Shape[K]['__queryType'] };
|
|
5668
|
+
operators: OperatorsAny;
|
|
5669
|
+
}
|
|
5670
|
+
export interface MapToNullableObjectColumn<Shape extends Column$1.QueryColumns> {
|
|
5671
|
+
dataType: 'object';
|
|
5672
|
+
__type: { [K in keyof Shape]: Shape[K]['__type'] };
|
|
5673
|
+
__outputType: ShallowSimplify$1<ObjectOutput<Shape>> | undefined;
|
|
5674
|
+
__queryType: { [K in keyof Shape]: Shape[K]['__queryType'] } | null;
|
|
5675
|
+
operators: OperatorsAny;
|
|
5676
|
+
}
|
|
5677
|
+
export interface MapToPluckColumn<Shape extends Column$1.QueryColumns> {
|
|
5678
|
+
dataType: 'array';
|
|
5679
|
+
__type: Shape['pluck']['__type'][];
|
|
5680
|
+
__outputType: Shape['pluck']['__outputType'][];
|
|
5681
|
+
__queryType: Shape['pluck']['__queryType'][];
|
|
5682
|
+
operators: OperatorsAny;
|
|
5683
|
+
}
|
|
5684
|
+
export interface MapToObjectArrayColumn<Shape extends Column$1.QueryColumns> {
|
|
5685
|
+
dataType: 'array';
|
|
5686
|
+
__type: { [K in keyof Shape]: Shape[K]['__type'] }[];
|
|
5687
|
+
__outputType: ShallowSimplify$1<ObjectOutput<Shape>>[];
|
|
5688
|
+
__queryType: { [K in keyof Shape]: Shape[K]['__queryType'] }[];
|
|
5689
|
+
operators: OperatorsAny;
|
|
5690
|
+
}
|
|
5691
|
+
type ObjectOutput<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
|
|
5692
|
+
export {};
|
|
5693
|
+
}
|
|
5694
|
+
interface SelectSelf extends PickQuerySelectable, PickQueryHasSelect, PickQueryDefaultSelect, PickQueryShape$1, PickQueryRelations$1, PickQueryResult, PickQueryReturnType, PickQueryWithData {}
|
|
5695
|
+
type SelectArgs<T extends SelectSelf> = ('*' | keyof T['__selectable'])[];
|
|
5696
|
+
interface SubQueryAddition<T extends PickQueryWithData> extends IsSubQuery {
|
|
5697
|
+
withData: T['withData'];
|
|
5698
|
+
}
|
|
5699
|
+
type SelectAsFnArg<T extends PickQueryRelationsWithData> = EmptyObject$1 extends T['relations'] ? T : { [K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? RelationQueryMaybeSingle<T['relations'][K]> & SubQueryAddition<T> : K extends keyof T ? T[K] : never };
|
|
5700
|
+
interface SelectAsArg<T extends SelectSelf> {
|
|
5701
|
+
[K: string]: keyof T['__selectable'] | Expression$1 | ((q: SelectAsFnArg<T>) => unknown);
|
|
5702
|
+
}
|
|
5703
|
+
type SelectAsFnReturnType = {
|
|
5704
|
+
result: Column$1.QueryColumns;
|
|
5705
|
+
returnType: Exclude<QueryReturnType$1, 'rows'>;
|
|
5706
|
+
} | Expression$1;
|
|
5707
|
+
interface SelectAsCheckReturnTypes {
|
|
5708
|
+
[K: string]: PropertyKey | Expression$1 | ((q: never) => SelectAsFnReturnType);
|
|
5709
|
+
}
|
|
5710
|
+
type SelectReturnType<T extends PickQueryReturnType> = T['returnType'] extends 'valueOrThrow' ? 'oneOrThrow' : T extends 'value' ? 'one' : T['returnType'] extends 'pluck' ? 'all' : T['returnType'];
|
|
5711
|
+
type SelectResult<T extends SelectSelf, Columns extends PropertyKey[]> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
|
|
5712
|
+
type SelectResultObj<T extends SelectSelf, Obj> = Obj extends SelectAsCheckReturnTypes ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? { [K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never } : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never }> : T[K] } : `Invalid return type of ${{ [K in keyof Obj]: Obj[K] extends ((...args: any[]) => any) ? ReturnType<Obj[K]> extends SelectAsFnReturnType ? never : K : never }[keyof Obj] & string}`;
|
|
5713
|
+
type SelectResultColumnsAndObj<T extends SelectSelf, Columns extends PropertyKey[], Obj> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? // Combine previously selected items, all columns if * was provided,
|
|
5714
|
+
{ [K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
|
|
5715
|
+
interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
|
|
5716
|
+
result: Column$1.QueryColumns;
|
|
5717
|
+
returnType: 'value' | 'valueOrThrow' | 'one' | 'oneOrThrow';
|
|
5718
|
+
}
|
|
5719
|
+
type SelectAsSelectable<Obj> = UnionToIntersection<{ [K in keyof Obj]: Obj[K] extends ((q: never) => infer R extends AllowedRelationOneQueryForSelectable) ? { [C in R['returnType'] extends 'value' | 'valueOrThrow' ? K : keyof R['result'] as R['returnType'] extends 'value' | 'valueOrThrow' ? K : `${K & string}.${C & string}`]: {
|
|
5720
|
+
as: C;
|
|
5721
|
+
column: R['returnType'] extends 'value' | 'valueOrThrow' ? R['result']['value'] : R['result'][C & keyof R['result']];
|
|
5722
|
+
} } : never }[keyof Obj]>;
|
|
5723
|
+
type SelectAsValueResult<T extends SelectSelf, Arg> = Arg extends keyof T['__selectable'] ? T['__selectable'][Arg]['column'] : Arg extends Expression$1 ? Arg['result']['value'] : Arg extends ((q: never) => IsQuery$1) ? SelectSubQueryResult<ReturnType<Arg>> : Arg extends ((q: never) => Expression$1) ? ReturnType<Arg>['result']['value'] : Arg extends ((q: never) => IsQuery$1 | Expression$1) ? SelectSubQueryResult<Exclude<ReturnType<Arg>, Expression$1>> | Exclude<ReturnType<Arg>, IsQuery$1>['result']['value'] : never;
|
|
5724
|
+
type SelectSubQueryResult<Arg extends SelectSelf> = Arg['returnType'] extends undefined | 'all' ? ColumnsShape$1.MapToObjectArrayColumn<Arg['result']> : Arg['returnType'] extends 'value' | 'valueOrThrow' ? Arg['result']['value'] : Arg['returnType'] extends 'pluck' ? ColumnsShape$1.MapToPluckColumn<Arg['result']> : Arg['returnType'] extends 'one' ? ColumnsShape$1.MapToNullableObjectColumn<Arg['result']> : ColumnsShape$1.MapToObjectColumn<Arg['result']>;
|
|
5725
|
+
declare class Select {
|
|
5726
|
+
/**
|
|
5727
|
+
* Takes a list of columns to be selected, and by default, the query builder will select all columns of the table.
|
|
5728
|
+
*
|
|
5729
|
+
* The last argument can be an object. Keys of the object are column aliases, value can be a column name, sub-query, or raw SQL expression.
|
|
5730
|
+
*
|
|
5731
|
+
* ```ts
|
|
5732
|
+
* import { sql } from './baseTable'
|
|
5733
|
+
*
|
|
5734
|
+
* // select columns of the table:
|
|
5735
|
+
* db.table.select('id', 'name', { idAlias: 'id' });
|
|
5736
|
+
*
|
|
5737
|
+
* // accepts columns with table names:
|
|
5738
|
+
* db.table.select('user.id', 'user.name', { nameAlias: 'user.name' });
|
|
5739
|
+
*
|
|
5740
|
+
* // table name may refer to the current table or a joined table:
|
|
5741
|
+
* db.table
|
|
5742
|
+
* .join(db.message, 'authorId', 'user.id')
|
|
5743
|
+
* .select('user.name', 'message.text', { textAlias: 'message.text' });
|
|
5744
|
+
*
|
|
5745
|
+
* // select value from the sub-query,
|
|
5746
|
+
* // this sub-query should return a single record and a single column:
|
|
5747
|
+
* db.table.select({
|
|
5748
|
+
* subQueryResult: Otherdb.table.select('column').take(),
|
|
5749
|
+
* });
|
|
5750
|
+
*
|
|
5751
|
+
* // select raw SQL value, specify the returning type via <generic> syntax:
|
|
5752
|
+
* db.table.select({
|
|
5753
|
+
* raw: sql<number>`1 + 2`,
|
|
5754
|
+
* });
|
|
5755
|
+
*
|
|
5756
|
+
* // select raw SQL value, the resulting type can be set by providing a column type in such way:
|
|
5757
|
+
* db.table.select({
|
|
5758
|
+
* raw: sql`1 + 2`.type((t) => t.integer()),
|
|
5759
|
+
* });
|
|
5760
|
+
*
|
|
5761
|
+
* // same raw SQL query as above, but the sql is returned from a callback
|
|
5762
|
+
* db.table.select({
|
|
5763
|
+
* raw: () => sql`1 + 2`.type((t) => t.integer()),
|
|
5764
|
+
* });
|
|
5765
|
+
* ```
|
|
5766
|
+
*
|
|
5767
|
+
* When you use the ORM and defined relations, `select` can also accept callbacks with related table queries:
|
|
5768
|
+
*
|
|
5769
|
+
* ```ts
|
|
5770
|
+
* await db.author.select({
|
|
5771
|
+
* allBooks: (q) => q.books,
|
|
5772
|
+
* firstBook: (q) => q.books.order({ createdAt: 'ASC' }).take(),
|
|
5773
|
+
* booksCount: (q) => q.books.count(),
|
|
5774
|
+
* });
|
|
5775
|
+
* ```
|
|
5776
|
+
*
|
|
5777
|
+
* When you're selecting a relation that's connected via `belongsTo` or `hasOne`, it becomes available to use in `order` or in `where`:
|
|
5778
|
+
*
|
|
5779
|
+
* ```ts
|
|
5780
|
+
* // select books with their authors included, order by author name and filter by author column:
|
|
5781
|
+
* await db.books
|
|
5782
|
+
* .select({
|
|
5783
|
+
* author: (q) => q.author,
|
|
5784
|
+
* })
|
|
5785
|
+
* .order('author.name')
|
|
5786
|
+
* .where({ 'author.isPopular': true });
|
|
5787
|
+
* ```
|
|
5788
|
+
*/
|
|
5789
|
+
select<T extends SelectSelf, Columns extends SelectArgs<T>>(this: T, ...args: Columns): SelectResult<T, Columns>;
|
|
5790
|
+
select<T extends SelectSelf, Obj extends SelectAsArg<T>>(this: T, obj: Obj): SelectResultObj<T, Obj>;
|
|
5791
|
+
select<T extends SelectSelf, Columns extends SelectArgs<T>, Obj extends SelectAsArg<T>>(this: T, ...args: [...columns: Columns, obj: Obj]): SelectResultColumnsAndObj<T, Columns, Obj>;
|
|
5792
|
+
/**
|
|
5793
|
+
* When querying the table or creating records, all columns are selected by default,
|
|
5794
|
+
* but updating and deleting queries are returning affected row counts by default.
|
|
5795
|
+
*
|
|
5796
|
+
* Use `selectAll` to select all columns. If the `.select` method was applied before it will be discarded.
|
|
5797
|
+
*
|
|
5798
|
+
* ```ts
|
|
5799
|
+
* const selectFull = await db.table
|
|
5800
|
+
* .select('id', 'name') // discarded by `selectAll`
|
|
5801
|
+
* .selectAll();
|
|
5802
|
+
*
|
|
5803
|
+
* const updatedFull = await db.table.selectAll().where(conditions).update(data);
|
|
5804
|
+
*
|
|
5805
|
+
* const deletedFull = await db.table.selectAll().where(conditions).delete();
|
|
5806
|
+
* ```
|
|
5807
|
+
*/
|
|
5808
|
+
selectAll<T extends SelectSelf>(this: T): SelectResult<T, ['*']>;
|
|
5809
|
+
}
|
|
5810
|
+
interface QueryGetSelf extends PickQuerySelectable, PickQueryRelationsWithData {}
|
|
5811
|
+
type GetArg<T extends QueryGetSelf> = GetStringArg<T> | Expression$1 | ((q: SelectAsFnArg<T>) => Expression$1 | Query.Pick.SingleValueResult);
|
|
5812
|
+
type GetStringArg<T extends PickQuerySelectable> = keyof T['__selectable'] & string;
|
|
5813
|
+
type ResolveGetArgColumn<Arg> = Arg extends Expression$1 ? Arg['result']['value'] : Arg extends ((q: never) => infer R) ? R extends Expression$1 ? R['result']['value'] : R extends Query.Pick.SingleValueResult ? R['result']['value'] : never : never;
|
|
5814
|
+
type GetResult<T extends QueryGetSelf, Arg extends GetArg<T>> = Arg extends string ? SetQueryReturnsValueOrThrow<T, Arg> : SetQueryReturnsColumnOrThrow<T, ResolveGetArgColumn<Arg>>;
|
|
5815
|
+
type GetResultOptional<T extends QueryGetSelf, Arg extends GetArg<T>> = Arg extends string ? SetQueryReturnsValueOptional<T, Arg> : SetQueryReturnsColumnOptional<T, ResolveGetArgColumn<Arg>>;
|
|
5821
5816
|
declare class QueryGet {
|
|
5822
5817
|
/**
|
|
5823
5818
|
* `.get` returns a single value, adds `LIMIT 1` to the query, and accepts a column name or a raw SQL expression.
|
|
@@ -7252,37 +7247,37 @@ declare namespace Column$1 {
|
|
|
7252
7247
|
unique: Name;
|
|
7253
7248
|
};
|
|
7254
7249
|
};
|
|
7255
|
-
export type Nullable<T extends Column
|
|
7250
|
+
export type Nullable<T extends Column.Pick.ForNullable, InputSchema, OutputSchema, QuerySchema> = { [K in keyof T]: K extends '__type' ? T['__type'] | null : K extends '__inputType' ? T['__inputType'] | null : K extends 'inputSchema' ? InputSchema : K extends '__outputType' ? T['__outputType'] | (unknown extends T['__nullType'] ? null : T['__nullType']) : K extends 'outputSchema' ? OutputSchema : K extends '__queryType' ? T['__queryType'] | null : K extends 'querySchema' ? QuerySchema : K extends 'data' ? T['data'] & DataNullable : K extends 'operators' ? { [K in keyof T['operators']]: K extends 'equals' | 'not' | 'isDistinctFrom' | 'isNotDistinctFrom' ? Operator<T['__queryType'] | null, T> : T['operators'][K] } : T[K] };
|
|
7256
7251
|
export type QueryColumnToNullable<C> = { [K in keyof C]: K extends '__outputType' | '__queryType' ? C[K] | null : C[K] };
|
|
7257
7252
|
export type QueryColumnToOptional<C> = { [K in keyof C]: K extends '__outputType' ? C[K] | undefined : C[K] };
|
|
7258
7253
|
interface DataNullable {
|
|
7259
7254
|
isNullable: true;
|
|
7260
7255
|
optional: true;
|
|
7261
7256
|
}
|
|
7262
|
-
export interface OperatorsNullable<
|
|
7263
|
-
equals: Operator<
|
|
7264
|
-
not: Operator<
|
|
7265
|
-
isDistinctFrom: Operator<
|
|
7266
|
-
isNotDistinctFrom: Operator<
|
|
7257
|
+
export interface OperatorsNullable<Column extends Column.Pick.QueryColumn> {
|
|
7258
|
+
equals: Operator<Column['__queryType'] | null, Column>;
|
|
7259
|
+
not: Operator<Column['__queryType'] | null, Column>;
|
|
7260
|
+
isDistinctFrom: Operator<Column['__queryType'] | null, Column>;
|
|
7261
|
+
isNotDistinctFrom: Operator<Column['__queryType'] | null, Column>;
|
|
7267
7262
|
}
|
|
7268
7263
|
export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends '__inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K] };
|
|
7269
7264
|
export type Parse<T extends Pick.ForParse, OutputSchema, Output> = { [K in keyof T]: K extends '__outputType' ? null extends T['__type'] ? (Output extends null ? never : Output) | (unknown extends T['__nullType'] ? null : T['__nullType']) : Output : K extends 'outputSchema' ? null extends T['__type'] ? OutputSchema | T['nullSchema'] : OutputSchema : T[K] };
|
|
7270
|
-
export type ParseNull<T extends Column
|
|
7271
|
-
type DefaultData<T extends Column
|
|
7272
|
-
export type Default<T extends Column
|
|
7273
|
-
type DefaultSelectData<T extends Column
|
|
7274
|
-
export type DefaultSelect<T extends Column
|
|
7265
|
+
export type ParseNull<T extends Column.Pick.ForParseNull, NullSchema, NullType> = { [K in keyof T]: K extends '__outputType' ? null extends T['__type'] ? Exclude<T['__outputType'], null> | NullType : T['__outputType'] : K extends '__nullType' ? NullType : K extends 'outputSchema' ? null extends T['__type'] ? T['outputSchema'] | NullSchema : T['outputSchema'] : K extends 'nullSchema' ? NullSchema : T[K] };
|
|
7266
|
+
type DefaultData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'default' ? Value extends null ? never : Value : K extends 'optional' ? true : T[K] };
|
|
7267
|
+
export type Default<T extends Column.Pick.Data, Value> = { [K in keyof T]: K extends 'data' ? DefaultData<T['data'], Value> : T[K] };
|
|
7268
|
+
type DefaultSelectData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'explicitSelect' ? Value extends true ? false : true : T[K] };
|
|
7269
|
+
export type DefaultSelect<T extends Column.Pick.Data, Value extends boolean> = { [K in keyof T]: K extends 'data' ? DefaultSelectData<T['data'], Value> : T[K] };
|
|
7275
7270
|
export interface IsAppReadOnly {
|
|
7276
7271
|
data: {
|
|
7277
7272
|
appReadOnly: true;
|
|
7278
7273
|
};
|
|
7279
7274
|
}
|
|
7280
|
-
export type Generated<T extends Column
|
|
7275
|
+
export type Generated<T extends Column.Pick.Data> = { [K in keyof T]: K extends 'data' ? { [K in keyof T['data']]: K extends 'default' ? true : T['data'][K] } : K extends '__inputType' ? never : T[K] };
|
|
7281
7276
|
export {};
|
|
7282
7277
|
}
|
|
7283
7278
|
export namespace Pick {
|
|
7284
7279
|
interface Data {
|
|
7285
|
-
data: Column
|
|
7280
|
+
data: Column.Data;
|
|
7286
7281
|
}
|
|
7287
7282
|
interface Type {
|
|
7288
7283
|
__type: unknown;
|
|
@@ -7327,7 +7322,7 @@ declare namespace Column$1 {
|
|
|
7327
7322
|
dataType: T;
|
|
7328
7323
|
}
|
|
7329
7324
|
interface QueryInit extends QueryColumn, InputType {
|
|
7330
|
-
data: Column
|
|
7325
|
+
data: Column.QueryData;
|
|
7331
7326
|
}
|
|
7332
7327
|
interface OutputSchema {
|
|
7333
7328
|
outputSchema: any;
|
|
@@ -7350,17 +7345,17 @@ declare namespace Column$1 {
|
|
|
7350
7345
|
}
|
|
7351
7346
|
export namespace Shape {
|
|
7352
7347
|
interface Data {
|
|
7353
|
-
[K: string]: Column
|
|
7348
|
+
[K: string]: Column.Pick.Data;
|
|
7354
7349
|
}
|
|
7355
7350
|
interface QueryInit {
|
|
7356
|
-
[K: string]: Column
|
|
7351
|
+
[K: string]: Column.Pick.QueryInit;
|
|
7357
7352
|
}
|
|
7358
7353
|
interface ForValidation {
|
|
7359
|
-
[K: string]: Column
|
|
7354
|
+
[K: string]: Column.Pick.ForValidation;
|
|
7360
7355
|
}
|
|
7361
7356
|
}
|
|
7362
7357
|
export interface QueryColumns {
|
|
7363
|
-
[K: string]: Column
|
|
7358
|
+
[K: string]: Column.Pick.QueryColumn;
|
|
7364
7359
|
}
|
|
7365
7360
|
export interface QueryColumnsInit {
|
|
7366
7361
|
[K: string]: Pick.QueryInit;
|
|
@@ -7374,7 +7369,7 @@ declare namespace Column$1 {
|
|
|
7374
7369
|
interface TableParam {
|
|
7375
7370
|
new (): TableParamInstance;
|
|
7376
7371
|
}
|
|
7377
|
-
type ColumnNameOfTable<Table extends Column
|
|
7372
|
+
type ColumnNameOfTable<Table extends Column.ForeignKey.TableParam> = Table extends (new () => {
|
|
7378
7373
|
columns: {
|
|
7379
7374
|
shape: infer R;
|
|
7380
7375
|
};
|
|
@@ -7421,10 +7416,10 @@ declare namespace Column$1 {
|
|
|
7421
7416
|
defaultDefault: unknown;
|
|
7422
7417
|
runtimeDefault?(): unknown;
|
|
7423
7418
|
explicitSelect?: boolean;
|
|
7424
|
-
as?: Column
|
|
7419
|
+
as?: Column.Pick.Data;
|
|
7425
7420
|
unique?: string;
|
|
7426
|
-
modifyQuery?(q: Query, column: Column
|
|
7427
|
-
checks?: Column
|
|
7421
|
+
modifyQuery?(q: Query, column: Column.Pick.Data): void;
|
|
7422
|
+
checks?: Column.Data.Check[];
|
|
7428
7423
|
isOfCustomType?: boolean;
|
|
7429
7424
|
errors?: RecordString$1;
|
|
7430
7425
|
defaultTimestamp?: 'createdAt' | 'updatedAt';
|
|
@@ -7456,6 +7451,8 @@ declare namespace Column$1 {
|
|
|
7456
7451
|
identity?: TableData$1.Identity;
|
|
7457
7452
|
generated?: Data.Generated;
|
|
7458
7453
|
readonly?: boolean;
|
|
7454
|
+
valueToArray?: boolean;
|
|
7455
|
+
skipValueToArray?: boolean;
|
|
7459
7456
|
}
|
|
7460
7457
|
export namespace Data {
|
|
7461
7458
|
interface Check {
|
|
@@ -8349,7 +8346,7 @@ type SelectAllColumn = string | SelectAllColumnExpression;
|
|
|
8349
8346
|
interface QueryData$1 extends QueryDataAliases, PickQueryDataParsers, HasHookSelect, MutativeQueriesSelectRelationsQueryData {
|
|
8350
8347
|
type: QueryType;
|
|
8351
8348
|
adapter: Adapter$1;
|
|
8352
|
-
|
|
8349
|
+
selectShape: ColumnsShape$1;
|
|
8353
8350
|
handleResult: HandleResult;
|
|
8354
8351
|
catch?: boolean;
|
|
8355
8352
|
returnType: QueryReturnType$1;
|
|
@@ -8886,6 +8883,28 @@ declare class QueryTruncate {
|
|
|
8886
8883
|
cascade?: boolean;
|
|
8887
8884
|
}): SetQueryReturnsVoid<T>;
|
|
8888
8885
|
}
|
|
8886
|
+
declare class QueryExistsMethods {
|
|
8887
|
+
/**
|
|
8888
|
+
* Use `exists()` to check if there is at least one record-matching condition.
|
|
8889
|
+
*
|
|
8890
|
+
* It will discard previous `select` statements if any. Returns a boolean.
|
|
8891
|
+
*
|
|
8892
|
+
* ```ts
|
|
8893
|
+
* const exists: boolean = await db.table.where(...conditions).exists();
|
|
8894
|
+
* ```
|
|
8895
|
+
*/
|
|
8896
|
+
exists<T extends QueryGetSelf>(this: T): SetQueryReturnsColumnOrThrow<T, BooleanQueryColumn>;
|
|
8897
|
+
/**
|
|
8898
|
+
* Use `notExists()` to check if there are no matching records.
|
|
8899
|
+
*
|
|
8900
|
+
* It will discard previous `select` statements if any. Returns a boolean.
|
|
8901
|
+
*
|
|
8902
|
+
* ```ts
|
|
8903
|
+
* const exists: boolean = await db.table.where(...conditions).notExists();
|
|
8904
|
+
* ```
|
|
8905
|
+
*/
|
|
8906
|
+
notExists<T extends QueryGetSelf>(this: T): SetQueryReturnsColumnOrThrow<T, BooleanQueryColumn>;
|
|
8907
|
+
}
|
|
8889
8908
|
type GroupArgs<T extends PickQueryResult> = ({ [K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' | 'runtimeComputed' ? never : K }[keyof T['result']] | Expression$1)[];
|
|
8890
8909
|
interface QueryHelperQuery<T extends PickQuerySelectableShapeAs> extends MergeQueryArg {
|
|
8891
8910
|
returnType: QueryReturnType$1;
|
|
@@ -8923,7 +8942,7 @@ interface NarrowPluckTypeResult<T extends PickQueryResultReturnType, Narrow> ext
|
|
|
8923
8942
|
}
|
|
8924
8943
|
type QueryIfResult<T extends PickQueryResultReturnType, R extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? { [K in keyof T['result'] | keyof R['result']]: K extends keyof T['result'] ? K extends keyof R['result'] ? R['result'][K] | T['result'][K] : T['result'][K] : Column$1.Modifiers.QueryColumnToOptional<R['result'][K]> } : K extends 'then' ? QueryIfResultThen<T, R> : T[K] };
|
|
8925
8944
|
type QueryIfResultThen<T extends PickQueryResultReturnType, R extends PickQueryResult> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType'] } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType'] }> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType'] } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType'] }> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType'] } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType'] }> : T['returnType'] extends 'value' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType']> : T['returnType'] extends 'rows' ? QueryThen<(T['result'][keyof T['result']]['__outputType'] | R['result'][keyof R['result']]['__outputType'])[][]> : T['returnType'] extends 'pluck' ? QueryThen<(T['result']['pluck']['__outputType'] | R['result']['pluck']['__outputType'])[]> : QueryThen<void>;
|
|
8926
|
-
interface QueryMethods<ColumnTypes> extends QueryClone, QueryAsMethods, AggregateMethods, QueryDistinct, Select, FromMethods, QueryJoin, QueryLimitOffset, CteQuery, Union, QueryJsonMethods, QueryCreate, QueryCreateFrom, QueryUpdate, QueryDelete, QueryStorage, QueryTransaction, QueryTruncate, For, Where, SearchMethods, Clear, Having, QueryCatchers, QueryLog, QueryOrder, QueryWithSchema, QueryHooks$1, QueryUpsert, QueryOrCreate, QueryGet, QueryPluck, MergeQueryMethods, QuerySql<ColumnTypes>, QueryTransform, QueryMap, QueryScope, SoftDeleteMethods, QueryExpressions, QueryWrap, QueryWindow {}
|
|
8945
|
+
interface QueryMethods<ColumnTypes> extends QueryClone, QueryAsMethods, AggregateMethods, QueryDistinct, Select, FromMethods, QueryJoin, QueryLimitOffset, CteQuery, Union, QueryJsonMethods, QueryCreate, QueryCreateFrom, QueryUpdate, QueryDelete, QueryStorage, QueryTransaction, QueryTruncate, For, Where, SearchMethods, Clear, Having, QueryCatchers, QueryLog, QueryOrder, QueryWithSchema, QueryHooks$1, QueryUpsert, QueryOrCreate, QueryGet, QueryPluck, MergeQueryMethods, QuerySql<ColumnTypes>, QueryTransform, QueryMap, QueryScope, SoftDeleteMethods, QueryExpressions, QueryWrap, QueryWindow, QueryExistsMethods {}
|
|
8927
8946
|
declare class QueryMethods<ColumnTypes> {
|
|
8928
8947
|
/**
|
|
8929
8948
|
* `.all` is a default behavior, that returns an array of objects:
|
|
@@ -8986,6 +9005,15 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
8986
9005
|
* ```
|
|
8987
9006
|
*/
|
|
8988
9007
|
exec<T>(this: T): SetQueryReturnsVoid<T>;
|
|
9008
|
+
/**
|
|
9009
|
+
* For relation selects, `require` changes LEFT JOIN LATERAL to JOIN LATERAL.
|
|
9010
|
+
*
|
|
9011
|
+
* ```ts
|
|
9012
|
+
* // only the records that have `related` will be loaded:
|
|
9013
|
+
* await db.table.select({ related: (q) => q.related.required() });
|
|
9014
|
+
* ```
|
|
9015
|
+
*/
|
|
9016
|
+
require<T extends PickQueryResultReturnType>(this: T): QueryRequire<T>;
|
|
8989
9017
|
/**
|
|
8990
9018
|
* Call `toSQL` on a query to get an object with a `text` SQL string and a `values` array of binding values:
|
|
8991
9019
|
*
|
|
@@ -9174,7 +9202,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
9174
9202
|
* // all the following queries will resolve into empty arrays
|
|
9175
9203
|
*
|
|
9176
9204
|
* await db.user.select({
|
|
9177
|
-
* pets: (q) => q.pets.
|
|
9205
|
+
* pets: (q) => q.pets.require().none(),
|
|
9178
9206
|
* });
|
|
9179
9207
|
*
|
|
9180
9208
|
* await db.user.join((q) => q.pets.none());
|
|
@@ -9246,7 +9274,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
9246
9274
|
*
|
|
9247
9275
|
* @param fn - helper function
|
|
9248
9276
|
*/
|
|
9249
|
-
makeHelper<T extends PickQuerySelectableShapeAs, Args extends unknown[], Result extends MergeQueryArg>(this: T, fn: (q: T, ...args: Args) => Result): QueryHelper<T, Args, Result>;
|
|
9277
|
+
makeHelper<T extends PickQuerySelectableShapeAs, Args extends unknown[], Result extends MergeQueryArg | Expression$1>(this: T, fn: (q: T, ...args: Args) => Result): QueryHelper<T, Args, Result>;
|
|
9250
9278
|
/**
|
|
9251
9279
|
* `useHelper` allows to use {@link makeHelper} in different queries:
|
|
9252
9280
|
*
|
|
@@ -9455,6 +9483,9 @@ declare namespace Query {
|
|
|
9455
9483
|
type Args<T extends Order.ArgThis> = Order.Args<T>;
|
|
9456
9484
|
}
|
|
9457
9485
|
namespace Pick {
|
|
9486
|
+
interface ReturnType {
|
|
9487
|
+
returnType: QueryReturnType$1;
|
|
9488
|
+
}
|
|
9458
9489
|
interface SingleValueResult {
|
|
9459
9490
|
result: {
|
|
9460
9491
|
value: Column$1.Pick.OutputType;
|
|
@@ -9475,6 +9506,7 @@ type SetQueryReturnsAll<T extends PickQueryResult> = { [K in keyof T]: K extends
|
|
|
9475
9506
|
type SetQueryReturnsAllResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplifyArr<T['result']> : T[K] } & QueryHasWhere$1;
|
|
9476
9507
|
type QueryTakeOptional<T extends PickQueryResultReturnType> = T['returnType'] extends 'value' | 'pluck' | 'void' ? T : T['returnType'] extends 'valueOrThrow' ? { [K in keyof T]: K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'] | undefined> : T[K] } : { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<T['result']>> : T[K] };
|
|
9477
9508
|
type QueryManyTakeOptional$1<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<T['result']>> : T[K] };
|
|
9509
|
+
type QueryRequire<T extends PickQueryResultReturnType> = T['returnType'] extends QueryReturnTypeAll | 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K] } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K] };
|
|
9478
9510
|
type QueryTake<T extends PickQueryResultReturnType> = T['returnType'] extends 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K] } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K] };
|
|
9479
9511
|
type QueryManyTake$1<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K] };
|
|
9480
9512
|
type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K] };
|
|
@@ -9981,4 +10013,4 @@ declare class QueryUpdate {
|
|
|
9981
10013
|
*/
|
|
9982
10014
|
updateManyByOptional<T extends UpdateManyBySelf, Keys extends UpdateManyByKeys<T>, K = UpdateManyByKeyColumns<Keys>>(this: T, keys: Keys, data: UpdateManyByData<T, K>): UpdateManyResult<T> & QueryHasWhere$1;
|
|
9983
10015
|
}
|
|
9984
|
-
export { type Adapter, AdapterClass, type AdapterConfigBase, type AdapterParams, type AdapterSchemaConfigOptions, type AfterCommitStandaloneHook, type AfterHook, ArrayColumn, type ArrayColumnValue, type ArrayData, type AsyncState, type BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CannotMutateReadOnlyTableError, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, type ColumnsShape, type ComputedColumnsFromOptions, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateCtx, type CreateData, type CreateManyMethodsNames, type CreateMethodsNames, type CreateSelf, CustomTypeColumn, DateColumn, type DateColumnData, type DbDomainArg, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbStructureDomainsMap, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultPrivileges, type DefaultSchemaConfig, type DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, type DriverAdapter, DynamicRawSQL, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionData, type FromArg, type FromResult, type GeneratorIgnore, type Grant, type HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type
|
|
10016
|
+
export { type Adapter, AdapterClass, type AdapterConfigBase, type AdapterParams, type AdapterSchemaConfigOptions, type AfterCommitStandaloneHook, type AfterHook, ArrayColumn, type ArrayColumnValue, type ArrayData, type AsyncState, type BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CannotMutateReadOnlyTableError, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, type ColumnsShape, type ComputedColumnsFromOptions, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateCtx, type CreateData, type CreateManyMethodsNames, type CreateMethodsNames, type CreateSelf, CustomTypeColumn, DateColumn, type DateColumnData, type DbDomainArg, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbStructureDomainsMap, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultPrivileges, type DefaultSchemaConfig, type DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, type DriverAdapter, DynamicRawSQL, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionData, type FromArg, type FromResult, type GeneratorIgnore, type Grant, type HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, type NumberColumnData, Operators, type OperatorsArray, type OperatorsJson, type OperatorsOrdinalText, type OperatorsText, OrchidOrmError, type Ord, PathColumn, type PickQueryInputType, type PickQueryInternal, type PickQueryQ, type PickQueryRelations, type PickQuerySelectableRelations, type PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type QueryAfterHook, type QueryBeforeActionHook, type QueryBeforeHook, type QueryData, type QueryHasWhere, QueryHookUtils, QueryHooks, type QueryInternal, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryManyTake, type QueryManyTakeOptional, type QueryOrExpression, type QueryResult, type QueryResultRow, type QueryReturnType, type QuerySchema, type QueryScopes, RawSql, type RawSqlBase, RealColumn, type RecordKeyTrue, type RecordOptionalString, type RecordString, type RecordStringOrNumber, type RecordUnknown, type RelationConfigBase, type RelationJoinQuery, type RelationsBase, type Rls, type RlsPolicy, type SchemaConfigFnWithOptions, type SearchWeight, type SelectableFromShape, SerialColumn, type SerialColumnData, type ShallowSimplify, type ShapeUniqueColumns, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type Sql, type SqlFn, type SqlSessionState, type StorageOptions, StringColumn, type StringData, type TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TemplateLiteralArgs, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, type Timestamps, type ToSQLCtx, type ToSqlValues, type TransactionAdapter, TransactionAdapterClass, type TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, type UniqueConstraints, type UniqueTableDataItem, UnknownColumn, type UpdateData, type UpdateSelf, type UpsertData, type UpsertThis, VarCharColumn, VirtualColumn, type WhereArg, XMLColumn, _appendQuery, _appendQueryOnUpsertCreate, _clone, _createDbSqlMethod, _hookSelectColumns, _initQueryBuilder, _orCreate, _prependWith, _queryCreate, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterUpdate, _queryInsert, _queryInsertMany, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, internalSchemaConfig, isExpression, isQueryReturnsAll, isRawSQL, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeConnectRetryConfig, noop, objectHasValues, omit, parseTableData, parseTableDataInput, pathToLog, pick, pluralize, prepareSubQueryForSql, primaryKeyInnerToCode, pushQueryOnForOuter, pushQueryValueImmutable, pushTableDataCode, queryToSql, quoteIdentifier, quoteObjectKey, quoteTableWithSchema, raw, rawSqlToCode, rawSqlToSql, referencesArgsToCode, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry };
|