drizzle-orm 0.29.0 → 0.29.1-e78b53e
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/mysql-core/db.cjs +134 -31
- package/mysql-core/db.cjs.map +1 -1
- package/mysql-core/db.d.cts +171 -1
- package/mysql-core/db.d.ts +171 -1
- package/mysql-core/db.js +134 -31
- package/mysql-core/db.js.map +1 -1
- package/mysql-core/query-builders/delete.cjs +29 -0
- package/mysql-core/query-builders/delete.cjs.map +1 -1
- package/mysql-core/query-builders/delete.d.cts +29 -0
- package/mysql-core/query-builders/delete.d.ts +29 -0
- package/mysql-core/query-builders/delete.js +29 -0
- package/mysql-core/query-builders/delete.js.map +1 -1
- package/mysql-core/query-builders/insert.cjs +26 -0
- package/mysql-core/query-builders/insert.cjs.map +1 -1
- package/mysql-core/query-builders/insert.d.cts +26 -0
- package/mysql-core/query-builders/insert.d.ts +26 -0
- package/mysql-core/query-builders/insert.js +26 -0
- package/mysql-core/query-builders/insert.js.map +1 -1
- package/mysql-core/query-builders/query.cjs +9 -1
- package/mysql-core/query-builders/query.cjs.map +1 -1
- package/mysql-core/query-builders/query.d.cts +1 -0
- package/mysql-core/query-builders/query.d.ts +1 -0
- package/mysql-core/query-builders/query.js +9 -1
- package/mysql-core/query-builders/query.js.map +1 -1
- package/mysql-core/query-builders/select.cjs +381 -0
- package/mysql-core/query-builders/select.cjs.map +1 -1
- package/mysql-core/query-builders/select.d.cts +604 -0
- package/mysql-core/query-builders/select.d.ts +604 -0
- package/mysql-core/query-builders/select.js +381 -0
- package/mysql-core/query-builders/select.js.map +1 -1
- package/mysql-core/query-builders/update.cjs +33 -0
- package/mysql-core/query-builders/update.cjs.map +1 -1
- package/mysql-core/query-builders/update.d.cts +33 -0
- package/mysql-core/query-builders/update.d.ts +33 -0
- package/mysql-core/query-builders/update.js +33 -0
- package/mysql-core/query-builders/update.js.map +1 -1
- package/mysql-core/view.cjs +2 -2
- package/mysql-core/view.cjs.map +1 -1
- package/mysql-core/view.d.cts +1 -1
- package/mysql-core/view.d.ts +1 -1
- package/mysql-core/view.js +2 -2
- package/mysql-core/view.js.map +1 -1
- package/mysql-proxy/migrator.cjs +2 -2
- package/mysql-proxy/migrator.cjs.map +1 -1
- package/mysql-proxy/migrator.js +2 -2
- package/mysql-proxy/migrator.js.map +1 -1
- package/package.json +25 -1
- package/pg-core/db.cjs +153 -34
- package/pg-core/db.cjs.map +1 -1
- package/pg-core/db.d.cts +211 -0
- package/pg-core/db.d.ts +211 -0
- package/pg-core/db.js +153 -34
- package/pg-core/db.js.map +1 -1
- package/pg-core/dialect.cjs +1 -1
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.js +1 -1
- package/pg-core/dialect.js.map +1 -1
- package/pg-core/query-builders/delete.cjs +29 -0
- package/pg-core/query-builders/delete.cjs.map +1 -1
- package/pg-core/query-builders/delete.d.cts +49 -0
- package/pg-core/query-builders/delete.d.ts +49 -0
- package/pg-core/query-builders/delete.js +29 -0
- package/pg-core/query-builders/delete.js.map +1 -1
- package/pg-core/query-builders/insert.cjs +51 -0
- package/pg-core/query-builders/insert.cjs.map +1 -1
- package/pg-core/query-builders/insert.d.cts +71 -0
- package/pg-core/query-builders/insert.d.ts +71 -0
- package/pg-core/query-builders/insert.js +51 -0
- package/pg-core/query-builders/insert.js.map +1 -1
- package/pg-core/query-builders/query.cjs +9 -2
- package/pg-core/query-builders/query.cjs.map +1 -1
- package/pg-core/query-builders/query.d.cts +1 -0
- package/pg-core/query-builders/query.d.ts +1 -0
- package/pg-core/query-builders/query.js +9 -2
- package/pg-core/query-builders/query.js.map +1 -1
- package/pg-core/query-builders/select.cjs +354 -48
- package/pg-core/query-builders/select.cjs.map +1 -1
- package/pg-core/query-builders/select.d.cts +555 -59
- package/pg-core/query-builders/select.d.ts +555 -59
- package/pg-core/query-builders/select.js +354 -48
- package/pg-core/query-builders/select.js.map +1 -1
- package/pg-core/query-builders/update.cjs +33 -0
- package/pg-core/query-builders/update.cjs.map +1 -1
- package/pg-core/query-builders/update.d.cts +55 -0
- package/pg-core/query-builders/update.d.ts +55 -0
- package/pg-core/query-builders/update.js +33 -0
- package/pg-core/query-builders/update.js.map +1 -1
- package/pg-proxy/migrator.cjs +1 -1
- package/pg-proxy/migrator.cjs.map +1 -1
- package/pg-proxy/migrator.js +1 -1
- package/pg-proxy/migrator.js.map +1 -1
- package/sql/functions/aggregate.cjs +69 -0
- package/sql/functions/aggregate.cjs.map +1 -0
- package/sql/functions/aggregate.d.cts +104 -0
- package/sql/functions/aggregate.d.ts +104 -0
- package/sql/functions/aggregate.js +38 -0
- package/sql/functions/aggregate.js.map +1 -0
- package/sql/functions/index.cjs +23 -0
- package/sql/functions/index.cjs.map +1 -0
- package/sql/functions/index.d.cts +1 -0
- package/sql/functions/index.d.ts +1 -0
- package/sql/functions/index.js +2 -0
- package/sql/functions/index.js.map +1 -0
- package/sql/index.cjs +3 -1
- package/sql/index.cjs.map +1 -1
- package/sql/index.d.cts +1 -0
- package/sql/index.d.ts +1 -0
- package/sql/index.js +1 -0
- package/sql/index.js.map +1 -1
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.js.map +1 -1
- package/sqlite-core/db.cjs +155 -36
- package/sqlite-core/db.cjs.map +1 -1
- package/sqlite-core/db.d.cts +187 -0
- package/sqlite-core/db.d.ts +187 -0
- package/sqlite-core/db.js +155 -36
- package/sqlite-core/db.js.map +1 -1
- package/sqlite-core/query-builders/delete.cjs +29 -0
- package/sqlite-core/query-builders/delete.cjs.map +1 -1
- package/sqlite-core/query-builders/delete.d.cts +49 -0
- package/sqlite-core/query-builders/delete.d.ts +49 -0
- package/sqlite-core/query-builders/delete.js +29 -0
- package/sqlite-core/query-builders/delete.js.map +1 -1
- package/sqlite-core/query-builders/insert.cjs +51 -0
- package/sqlite-core/query-builders/insert.cjs.map +1 -1
- package/sqlite-core/query-builders/insert.d.cts +71 -0
- package/sqlite-core/query-builders/insert.d.ts +71 -0
- package/sqlite-core/query-builders/insert.js +51 -0
- package/sqlite-core/query-builders/insert.js.map +1 -1
- package/sqlite-core/query-builders/select.cjs +291 -0
- package/sqlite-core/query-builders/select.cjs.map +1 -1
- package/sqlite-core/query-builders/select.d.cts +434 -0
- package/sqlite-core/query-builders/select.d.ts +434 -0
- package/sqlite-core/query-builders/select.js +291 -0
- package/sqlite-core/query-builders/select.js.map +1 -1
- package/sqlite-core/query-builders/select.types.cjs.map +1 -1
- package/sqlite-core/query-builders/update.cjs +33 -0
- package/sqlite-core/query-builders/update.cjs.map +1 -1
- package/sqlite-core/query-builders/update.d.cts +55 -0
- package/sqlite-core/query-builders/update.d.ts +55 -0
- package/sqlite-core/query-builders/update.js +33 -0
- package/sqlite-core/query-builders/update.js.map +1 -1
- package/version.cjs +1 -1
- package/version.d.cts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/sqlite-core/query-builders/update.ts"],"sourcesContent":["import type { GetColumnData } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { SelectResultFields } from '~/query-builders/select.types.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport type { Query, SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { SQLiteDialect } from '~/sqlite-core/dialect.ts';\nimport type { SQLitePreparedQuery, SQLiteSession } from '~/sqlite-core/session.ts';\nimport { SQLiteTable } from '~/sqlite-core/table.ts';\nimport { type DrizzleTypeError, mapUpdateSet, orderSelectedFields, type UpdateSet } from '~/utils.ts';\nimport type { SelectedFields, SelectedFieldsOrdered } from './select.types.ts';\n\nexport interface SQLiteUpdateConfig {\n\twhere?: SQL | undefined;\n\tset: UpdateSet;\n\ttable: SQLiteTable;\n\treturning?: SelectedFieldsOrdered;\n}\n\nexport type SQLiteUpdateSetSource<TTable extends SQLiteTable> =\n\t& {\n\t\t[Key in keyof TTable['_']['columns']]?:\n\t\t\t| GetColumnData<TTable['_']['columns'][Key], 'query'>\n\t\t\t| SQL;\n\t}\n\t& {};\n\nexport class SQLiteUpdateBuilder<\n\tTTable extends SQLiteTable,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteUpdateBuilder';\n\n\tdeclare readonly _: {\n\t\treadonly table: TTable;\n\t};\n\n\tconstructor(\n\t\tprotected table: TTable,\n\t\tprotected session: SQLiteSession<any, any, any, any>,\n\t\tprotected dialect: SQLiteDialect,\n\t) {}\n\n\tset(values: SQLiteUpdateSetSource<TTable>): SQLiteUpdateBase<TTable, TResultType, TRunResult> {\n\t\treturn new SQLiteUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect);\n\t}\n}\n\nexport type SQLiteUpdateWithout<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tK extends keyof T & string,\n> = TDynamic extends true ? T : Omit<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['returning'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods'] | K\n\t>,\n\tT['_']['excludedMethods'] | K\n>;\n\nexport type SQLiteUpdateReturningAll<T extends AnySQLiteUpdate, TDynamic extends boolean> = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['table']['$inferSelect'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateReturning<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tTSelectedFields extends SelectedFields,\n> = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tSelectResultFields<TSelectedFields>,\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateExecute<T extends AnySQLiteUpdate> = T['_']['returning'] extends undefined ? T['_']['runResult']\n\t: T['_']['returning'][];\n\nexport type SQLiteUpdatePrepare<T extends AnySQLiteUpdate> = SQLitePreparedQuery<\n\t{\n\t\ttype: T['_']['resultType'];\n\t\trun: T['_']['runResult'];\n\t\tall: T['_']['returning'] extends undefined ? DrizzleTypeError<'.all() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'][];\n\t\tget: T['_']['returning'] extends undefined ? DrizzleTypeError<'.get() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'];\n\t\tvalues: T['_']['returning'] extends undefined ? DrizzleTypeError<'.values() cannot be used without .returning()'>\n\t\t\t: any[][];\n\t\texecute: SQLiteUpdateExecute<T>;\n\t}\n>;\n\nexport type SQLiteUpdateDynamic<T extends AnySQLiteUpdate> = SQLiteUpdate<\n\tT['_']['table'],\n\tT['_']['resultType'],\n\tT['_']['runResult'],\n\tT['_']['returning']\n>;\n\nexport type SQLiteUpdate<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = any,\n\tTReturning extends Record<string, unknown> | undefined = Record<string, unknown> | undefined,\n> = SQLiteUpdateBase<TTable, TResultType, TRunResult, TReturning, true, never>;\n\ntype AnySQLiteUpdate = SQLiteUpdateBase<any, any, any, any, any, any>;\n\nexport interface SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n> extends SQLWrapper, QueryPromise<TReturning extends undefined ? TRunResult : TReturning[]> {\n\treadonly _: {\n\t\treadonly dialect: 'sqlite';\n\t\treadonly table: TTable;\n\t\treadonly resultType: TResultType;\n\t\treadonly runResult: TRunResult;\n\t\treadonly returning: TReturning;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TReturning extends undefined ? TRunResult : TReturning[];\n\t};\n}\n\nexport class SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTDynamic extends boolean = false,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTExcludedMethods extends string = never,\n> extends QueryPromise<TReturning extends undefined ? TRunResult : TReturning[]>\n\timplements RunnableQuery<TReturning extends undefined ? TRunResult : TReturning[], 'sqlite'>, SQLWrapper\n{\n\tstatic readonly [entityKind]: string = 'SQLiteUpdate';\n\n\t/** @internal */\n\tconfig: SQLiteUpdateConfig;\n\n\tconstructor(\n\t\ttable: TTable,\n\t\tset: UpdateSet,\n\t\tprivate session: SQLiteSession<any, any, any, any>,\n\t\tprivate dialect: SQLiteDialect,\n\t) {\n\t\tsuper();\n\t\tthis.config = { set, table };\n\t}\n\n\twhere(where: SQL | undefined): SQLiteUpdateWithout<this, TDynamic, 'where'> {\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\treturning(): SQLiteUpdateReturningAll<this, TDynamic>;\n\treturning<TSelectedFields extends SelectedFields>(\n\t\tfields: TSelectedFields,\n\t): SQLiteUpdateReturning<this, TDynamic, TSelectedFields>;\n\treturning(\n\t\tfields: SelectedFields = this.config.table[SQLiteTable.Symbol.Columns],\n\t): SQLiteUpdateWithout<AnySQLiteUpdate, TDynamic, 'returning'> {\n\t\tthis.config.returning = orderSelectedFields(fields);\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildUpdateQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\tprepare(isOneTimeQuery?: boolean): SQLiteUpdatePrepare<this> {\n\t\treturn this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](\n\t\t\tthis.dialect.sqlToQuery(this.getSQL()),\n\t\t\tthis.config.returning,\n\t\t\tthis.config.returning ? 'all' : 'run',\n\t\t) as SQLiteUpdatePrepare<this>;\n\t}\n\n\trun: ReturnType<this['prepare']>['run'] = (placeholderValues) => {\n\t\treturn this.prepare(true).run(placeholderValues);\n\t};\n\n\tall: ReturnType<this['prepare']>['all'] = (placeholderValues) => {\n\t\treturn this.prepare(true).all(placeholderValues);\n\t};\n\n\tget: ReturnType<this['prepare']>['get'] = (placeholderValues) => {\n\t\treturn this.prepare(true).get(placeholderValues);\n\t};\n\n\tvalues: ReturnType<this['prepare']>['values'] = (placeholderValues) => {\n\t\treturn this.prepare(true).values(placeholderValues);\n\t};\n\n\toverride async execute(): Promise<SQLiteUpdateExecute<this>> {\n\t\treturn (this.config.returning ? this.all() : this.run()) as SQLiteUpdateExecute<this>;\n\t}\n\n\t$dynamic(): SQLiteUpdateDynamic<this> {\n\t\treturn this as any;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA2B;AAE3B,2BAA6B;AAK7B,mBAA4B;AAC5B,mBAAyF;AAkBlF,MAAM,oBAIX;AAAA,EAOD,YACW,OACA,SACA,SACT;AAHS;AACA;AACA;AAAA,EACR;AAAA,EAVH,QAAiB,wBAAU,IAAY;AAAA,EAYvC,IAAI,QAA0F;AAC7F,WAAO,IAAI,iBAAiB,KAAK,WAAO,2BAAa,KAAK,OAAO,MAAM,GAAG,KAAK,SAAS,KAAK,OAAO;AAAA,EACrG;AACD;AAqGO,MAAM,yBAUH,kCAEV;AAAA,EAMC,YACC,OACA,KACQ,SACA,SACP;AACD,UAAM;AAHE;AACA;AAGR,SAAK,S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AAAA,EACR;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/sqlite-core/query-builders/update.ts"],"sourcesContent":["import type { GetColumnData } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { SelectResultFields } from '~/query-builders/select.types.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport type { Query, SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { SQLiteDialect } from '~/sqlite-core/dialect.ts';\nimport type { SQLitePreparedQuery, SQLiteSession } from '~/sqlite-core/session.ts';\nimport { SQLiteTable } from '~/sqlite-core/table.ts';\nimport { type DrizzleTypeError, mapUpdateSet, orderSelectedFields, type UpdateSet } from '~/utils.ts';\nimport type { SelectedFields, SelectedFieldsOrdered } from './select.types.ts';\nimport type { SQLiteColumn } from '../columns/common.ts';\n\nexport interface SQLiteUpdateConfig {\n\twhere?: SQL | undefined;\n\tset: UpdateSet;\n\ttable: SQLiteTable;\n\treturning?: SelectedFieldsOrdered;\n}\n\nexport type SQLiteUpdateSetSource<TTable extends SQLiteTable> =\n\t& {\n\t\t[Key in keyof TTable['_']['columns']]?:\n\t\t\t| GetColumnData<TTable['_']['columns'][Key], 'query'>\n\t\t\t| SQL;\n\t}\n\t& {};\n\nexport class SQLiteUpdateBuilder<\n\tTTable extends SQLiteTable,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteUpdateBuilder';\n\n\tdeclare readonly _: {\n\t\treadonly table: TTable;\n\t};\n\n\tconstructor(\n\t\tprotected table: TTable,\n\t\tprotected session: SQLiteSession<any, any, any, any>,\n\t\tprotected dialect: SQLiteDialect,\n\t) {}\n\n\tset(values: SQLiteUpdateSetSource<TTable>): SQLiteUpdateBase<TTable, TResultType, TRunResult> {\n\t\treturn new SQLiteUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect);\n\t}\n}\n\nexport type SQLiteUpdateWithout<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tK extends keyof T & string,\n> = TDynamic extends true ? T : Omit<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['returning'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods'] | K\n\t>,\n\tT['_']['excludedMethods'] | K\n>;\n\nexport type SQLiteUpdateReturningAll<T extends AnySQLiteUpdate, TDynamic extends boolean> = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['table']['$inferSelect'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateReturning<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tTSelectedFields extends SelectedFields,\n> = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tSelectResultFields<TSelectedFields>,\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateExecute<T extends AnySQLiteUpdate> = T['_']['returning'] extends undefined ? T['_']['runResult']\n\t: T['_']['returning'][];\n\nexport type SQLiteUpdatePrepare<T extends AnySQLiteUpdate> = SQLitePreparedQuery<\n\t{\n\t\ttype: T['_']['resultType'];\n\t\trun: T['_']['runResult'];\n\t\tall: T['_']['returning'] extends undefined ? DrizzleTypeError<'.all() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'][];\n\t\tget: T['_']['returning'] extends undefined ? DrizzleTypeError<'.get() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'];\n\t\tvalues: T['_']['returning'] extends undefined ? DrizzleTypeError<'.values() cannot be used without .returning()'>\n\t\t\t: any[][];\n\t\texecute: SQLiteUpdateExecute<T>;\n\t}\n>;\n\nexport type SQLiteUpdateDynamic<T extends AnySQLiteUpdate> = SQLiteUpdate<\n\tT['_']['table'],\n\tT['_']['resultType'],\n\tT['_']['runResult'],\n\tT['_']['returning']\n>;\n\nexport type SQLiteUpdate<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = any,\n\tTReturning extends Record<string, unknown> | undefined = Record<string, unknown> | undefined,\n> = SQLiteUpdateBase<TTable, TResultType, TRunResult, TReturning, true, never>;\n\ntype AnySQLiteUpdate = SQLiteUpdateBase<any, any, any, any, any, any>;\n\nexport interface SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n> extends SQLWrapper, QueryPromise<TReturning extends undefined ? TRunResult : TReturning[]> {\n\treadonly _: {\n\t\treadonly dialect: 'sqlite';\n\t\treadonly table: TTable;\n\t\treadonly resultType: TResultType;\n\t\treadonly runResult: TRunResult;\n\t\treadonly returning: TReturning;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TReturning extends undefined ? TRunResult : TReturning[];\n\t};\n}\n\nexport class SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTDynamic extends boolean = false,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTExcludedMethods extends string = never,\n> extends QueryPromise<TReturning extends undefined ? TRunResult : TReturning[]>\n\timplements RunnableQuery<TReturning extends undefined ? TRunResult : TReturning[], 'sqlite'>, SQLWrapper\n{\n\tstatic readonly [entityKind]: string = 'SQLiteUpdate';\n\n\t/** @internal */\n\tconfig: SQLiteUpdateConfig;\n\n\tconstructor(\n\t\ttable: TTable,\n\t\tset: UpdateSet,\n\t\tprivate session: SQLiteSession<any, any, any, any>,\n\t\tprivate dialect: SQLiteDialect,\n\t) {\n\t\tsuper();\n\t\tthis.config = { set, table };\n\t}\n\n\t/**\n\t * Adds a 'where' clause to the query.\n\t * \n\t * Calling this method will update only those rows that fulfill a specified condition.\n\t * \n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t * \n\t * @param where the 'where' clause.\n\t * \n\t * @example\n\t * You can use conditional operators and `sql function` to filter the rows to be updated.\n\t * \n\t * ```ts\n\t * // Update all cars with green color\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(eq(cars.color, 'green'));\n\t * // or\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(sql`${cars.color} = 'green'`)\n\t * ```\n\t * \n\t * You can logically combine conditional operators with `and()` and `or()` operators:\n\t * \n\t * ```ts\n\t * // Update all BMW cars with a green color\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));\n\t * \n\t * // Update all cars with the green or blue color\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));\n\t * ```\n\t */\n\twhere(where: SQL | undefined): SQLiteUpdateWithout<this, TDynamic, 'where'> {\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `returning` clause to the query.\n\t * \n\t * Calling this method will return the specified fields of the updated rows. If no fields are specified, all fields will be returned.\n\t * \n\t * See docs: {@link https://orm.drizzle.team/docs/update#update-with-returning}\n\t * \n\t * @example\n\t * ```ts\n\t * // Update all cars with the green color and return all fields\n\t * const updatedCars: Car[] = await db.update(cars)\n\t * .set({ color: 'red' })\n\t * .where(eq(cars.color, 'green'))\n\t * .returning();\n\t * \n\t * // Update all cars with the green color and return only their id and brand fields\n\t * const updatedCarsIdsAndBrands: { id: number, brand: string }[] = await db.update(cars)\n\t * .set({ color: 'red' })\n\t * .where(eq(cars.color, 'green'))\n\t * .returning({ id: cars.id, brand: cars.brand });\n\t * ```\n\t */\n\treturning(): SQLiteUpdateReturningAll<this, TDynamic>;\n\treturning<TSelectedFields extends SelectedFields>(\n\t\tfields: TSelectedFields,\n\t): SQLiteUpdateReturning<this, TDynamic, TSelectedFields>;\n\treturning(\n\t\tfields: SelectedFields = this.config.table[SQLiteTable.Symbol.Columns],\n\t): SQLiteUpdateWithout<AnySQLiteUpdate, TDynamic, 'returning'> {\n\t\tthis.config.returning = orderSelectedFields<SQLiteColumn>(fields);\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildUpdateQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\tprepare(isOneTimeQuery?: boolean): SQLiteUpdatePrepare<this> {\n\t\treturn this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](\n\t\t\tthis.dialect.sqlToQuery(this.getSQL()),\n\t\t\tthis.config.returning,\n\t\t\tthis.config.returning ? 'all' : 'run',\n\t\t) as SQLiteUpdatePrepare<this>;\n\t}\n\n\trun: ReturnType<this['prepare']>['run'] = (placeholderValues) => {\n\t\treturn this.prepare(true).run(placeholderValues);\n\t};\n\n\tall: ReturnType<this['prepare']>['all'] = (placeholderValues) => {\n\t\treturn this.prepare(true).all(placeholderValues);\n\t};\n\n\tget: ReturnType<this['prepare']>['get'] = (placeholderValues) => {\n\t\treturn this.prepare(true).get(placeholderValues);\n\t};\n\n\tvalues: ReturnType<this['prepare']>['values'] = (placeholderValues) => {\n\t\treturn this.prepare(true).values(placeholderValues);\n\t};\n\n\toverride async execute(): Promise<SQLiteUpdateExecute<this>> {\n\t\treturn (this.config.returning ? this.all() : this.run()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AAO,CAAC;AAC5E,WAAO;AAAA,EACR;AAAA,EAEA,QAAQ,gBAAqD;AAC5D,WAAO,KAAK,QAAQ,iBAAiB,wBAAwB,cAAc;AAAA,MAC1E,KAAK,QAAQ,WAAW,KAAK,OAAO,CAAC;AAAA,MACrC,KAAK,OAAO;AAAA,MACZ,KAAK,OAAO,YAAY,QAAQ;AAAA,IACjC;AAAA,EACD;AAAA,EAEA,MAA0C,CAAC,sBAAsB;AAChE,WAAO,KAAK,QAAQ,IAAI,EAAE,IAAI,iBAAiB;AAAA,EAChD;AAAA,EAEA,MAA0C,CAAC,sBAAsB;AAChE,WAAO,KAAK,QAAQ,IAAI,EAAE,IAAI,iBAAiB;AAAA,EAChD;AAAA,EAEA,MAA0C,CAAC,sBAAsB;AAChE,WAAO,KAAK,QAAQ,IAAI,EAAE,IAAI,iBAAiB;AAAA,EAChD;AAAA,EAEA,SAAgD,CAAC,sBAAsB;AACtE,WAAO,KAAK,QAAQ,IAAI,EAAE,OAAO,iBAAiB;AAAA,EACnD;AAAA,EAEA,MAAe,UAA8C;AAC5D,WAAQ,KAAK,OAAO,YAAY,KAAK,IAAI,IAAI,KAAK,IAAI;AAAA,EACvD;AAAA,EAEA,WAAsC;AACrC,WAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -61,7 +61,62 @@ export declare class SQLiteUpdateBase<TTable extends SQLiteTable = SQLiteTable,
|
|
|
61
61
|
private dialect;
|
|
62
62
|
static readonly [entityKind]: string;
|
|
63
63
|
constructor(table: TTable, set: UpdateSet, session: SQLiteSession<any, any, any, any>, dialect: SQLiteDialect);
|
|
64
|
+
/**
|
|
65
|
+
* Adds a 'where' clause to the query.
|
|
66
|
+
*
|
|
67
|
+
* Calling this method will update only those rows that fulfill a specified condition.
|
|
68
|
+
*
|
|
69
|
+
* See docs: {@link https://orm.drizzle.team/docs/update}
|
|
70
|
+
*
|
|
71
|
+
* @param where the 'where' clause.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* You can use conditional operators and `sql function` to filter the rows to be updated.
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* // Update all cars with green color
|
|
78
|
+
* db.update(cars).set({ color: 'red' })
|
|
79
|
+
* .where(eq(cars.color, 'green'));
|
|
80
|
+
* // or
|
|
81
|
+
* db.update(cars).set({ color: 'red' })
|
|
82
|
+
* .where(sql`${cars.color} = 'green'`)
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* You can logically combine conditional operators with `and()` and `or()` operators:
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* // Update all BMW cars with a green color
|
|
89
|
+
* db.update(cars).set({ color: 'red' })
|
|
90
|
+
* .where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
|
|
91
|
+
*
|
|
92
|
+
* // Update all cars with the green or blue color
|
|
93
|
+
* db.update(cars).set({ color: 'red' })
|
|
94
|
+
* .where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
64
97
|
where(where: SQL | undefined): SQLiteUpdateWithout<this, TDynamic, 'where'>;
|
|
98
|
+
/**
|
|
99
|
+
* Adds a `returning` clause to the query.
|
|
100
|
+
*
|
|
101
|
+
* Calling this method will return the specified fields of the updated rows. If no fields are specified, all fields will be returned.
|
|
102
|
+
*
|
|
103
|
+
* See docs: {@link https://orm.drizzle.team/docs/update#update-with-returning}
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* // Update all cars with the green color and return all fields
|
|
108
|
+
* const updatedCars: Car[] = await db.update(cars)
|
|
109
|
+
* .set({ color: 'red' })
|
|
110
|
+
* .where(eq(cars.color, 'green'))
|
|
111
|
+
* .returning();
|
|
112
|
+
*
|
|
113
|
+
* // Update all cars with the green color and return only their id and brand fields
|
|
114
|
+
* const updatedCarsIdsAndBrands: { id: number, brand: string }[] = await db.update(cars)
|
|
115
|
+
* .set({ color: 'red' })
|
|
116
|
+
* .where(eq(cars.color, 'green'))
|
|
117
|
+
* .returning({ id: cars.id, brand: cars.brand });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
65
120
|
returning(): SQLiteUpdateReturningAll<this, TDynamic>;
|
|
66
121
|
returning<TSelectedFields extends SelectedFields>(fields: TSelectedFields): SQLiteUpdateReturning<this, TDynamic, TSelectedFields>;
|
|
67
122
|
toSQL(): Query;
|
|
@@ -61,7 +61,62 @@ export declare class SQLiteUpdateBase<TTable extends SQLiteTable = SQLiteTable,
|
|
|
61
61
|
private dialect;
|
|
62
62
|
static readonly [entityKind]: string;
|
|
63
63
|
constructor(table: TTable, set: UpdateSet, session: SQLiteSession<any, any, any, any>, dialect: SQLiteDialect);
|
|
64
|
+
/**
|
|
65
|
+
* Adds a 'where' clause to the query.
|
|
66
|
+
*
|
|
67
|
+
* Calling this method will update only those rows that fulfill a specified condition.
|
|
68
|
+
*
|
|
69
|
+
* See docs: {@link https://orm.drizzle.team/docs/update}
|
|
70
|
+
*
|
|
71
|
+
* @param where the 'where' clause.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* You can use conditional operators and `sql function` to filter the rows to be updated.
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* // Update all cars with green color
|
|
78
|
+
* db.update(cars).set({ color: 'red' })
|
|
79
|
+
* .where(eq(cars.color, 'green'));
|
|
80
|
+
* // or
|
|
81
|
+
* db.update(cars).set({ color: 'red' })
|
|
82
|
+
* .where(sql`${cars.color} = 'green'`)
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* You can logically combine conditional operators with `and()` and `or()` operators:
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* // Update all BMW cars with a green color
|
|
89
|
+
* db.update(cars).set({ color: 'red' })
|
|
90
|
+
* .where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
|
|
91
|
+
*
|
|
92
|
+
* // Update all cars with the green or blue color
|
|
93
|
+
* db.update(cars).set({ color: 'red' })
|
|
94
|
+
* .where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
64
97
|
where(where: SQL | undefined): SQLiteUpdateWithout<this, TDynamic, 'where'>;
|
|
98
|
+
/**
|
|
99
|
+
* Adds a `returning` clause to the query.
|
|
100
|
+
*
|
|
101
|
+
* Calling this method will return the specified fields of the updated rows. If no fields are specified, all fields will be returned.
|
|
102
|
+
*
|
|
103
|
+
* See docs: {@link https://orm.drizzle.team/docs/update#update-with-returning}
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* // Update all cars with the green color and return all fields
|
|
108
|
+
* const updatedCars: Car[] = await db.update(cars)
|
|
109
|
+
* .set({ color: 'red' })
|
|
110
|
+
* .where(eq(cars.color, 'green'))
|
|
111
|
+
* .returning();
|
|
112
|
+
*
|
|
113
|
+
* // Update all cars with the green color and return only their id and brand fields
|
|
114
|
+
* const updatedCarsIdsAndBrands: { id: number, brand: string }[] = await db.update(cars)
|
|
115
|
+
* .set({ color: 'red' })
|
|
116
|
+
* .where(eq(cars.color, 'green'))
|
|
117
|
+
* .returning({ id: cars.id, brand: cars.brand });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
65
120
|
returning(): SQLiteUpdateReturningAll<this, TDynamic>;
|
|
66
121
|
returning<TSelectedFields extends SelectedFields>(fields: TSelectedFields): SQLiteUpdateReturning<this, TDynamic, TSelectedFields>;
|
|
67
122
|
toSQL(): Query;
|
|
@@ -23,6 +23,39 @@ class SQLiteUpdateBase extends QueryPromise {
|
|
|
23
23
|
static [entityKind] = "SQLiteUpdate";
|
|
24
24
|
/** @internal */
|
|
25
25
|
config;
|
|
26
|
+
/**
|
|
27
|
+
* Adds a 'where' clause to the query.
|
|
28
|
+
*
|
|
29
|
+
* Calling this method will update only those rows that fulfill a specified condition.
|
|
30
|
+
*
|
|
31
|
+
* See docs: {@link https://orm.drizzle.team/docs/update}
|
|
32
|
+
*
|
|
33
|
+
* @param where the 'where' clause.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* You can use conditional operators and `sql function` to filter the rows to be updated.
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* // Update all cars with green color
|
|
40
|
+
* db.update(cars).set({ color: 'red' })
|
|
41
|
+
* .where(eq(cars.color, 'green'));
|
|
42
|
+
* // or
|
|
43
|
+
* db.update(cars).set({ color: 'red' })
|
|
44
|
+
* .where(sql`${cars.color} = 'green'`)
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* You can logically combine conditional operators with `and()` and `or()` operators:
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* // Update all BMW cars with a green color
|
|
51
|
+
* db.update(cars).set({ color: 'red' })
|
|
52
|
+
* .where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
|
|
53
|
+
*
|
|
54
|
+
* // Update all cars with the green or blue color
|
|
55
|
+
* db.update(cars).set({ color: 'red' })
|
|
56
|
+
* .where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
26
59
|
where(where) {
|
|
27
60
|
this.config.where = where;
|
|
28
61
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/sqlite-core/query-builders/update.ts"],"sourcesContent":["import type { GetColumnData } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { SelectResultFields } from '~/query-builders/select.types.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport type { Query, SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { SQLiteDialect } from '~/sqlite-core/dialect.ts';\nimport type { SQLitePreparedQuery, SQLiteSession } from '~/sqlite-core/session.ts';\nimport { SQLiteTable } from '~/sqlite-core/table.ts';\nimport { type DrizzleTypeError, mapUpdateSet, orderSelectedFields, type UpdateSet } from '~/utils.ts';\nimport type { SelectedFields, SelectedFieldsOrdered } from './select.types.ts';\n\nexport interface SQLiteUpdateConfig {\n\twhere?: SQL | undefined;\n\tset: UpdateSet;\n\ttable: SQLiteTable;\n\treturning?: SelectedFieldsOrdered;\n}\n\nexport type SQLiteUpdateSetSource<TTable extends SQLiteTable> =\n\t& {\n\t\t[Key in keyof TTable['_']['columns']]?:\n\t\t\t| GetColumnData<TTable['_']['columns'][Key], 'query'>\n\t\t\t| SQL;\n\t}\n\t& {};\n\nexport class SQLiteUpdateBuilder<\n\tTTable extends SQLiteTable,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteUpdateBuilder';\n\n\tdeclare readonly _: {\n\t\treadonly table: TTable;\n\t};\n\n\tconstructor(\n\t\tprotected table: TTable,\n\t\tprotected session: SQLiteSession<any, any, any, any>,\n\t\tprotected dialect: SQLiteDialect,\n\t) {}\n\n\tset(values: SQLiteUpdateSetSource<TTable>): SQLiteUpdateBase<TTable, TResultType, TRunResult> {\n\t\treturn new SQLiteUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect);\n\t}\n}\n\nexport type SQLiteUpdateWithout<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tK extends keyof T & string,\n> = TDynamic extends true ? T : Omit<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['returning'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods'] | K\n\t>,\n\tT['_']['excludedMethods'] | K\n>;\n\nexport type SQLiteUpdateReturningAll<T extends AnySQLiteUpdate, TDynamic extends boolean> = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['table']['$inferSelect'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateReturning<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tTSelectedFields extends SelectedFields,\n> = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tSelectResultFields<TSelectedFields>,\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateExecute<T extends AnySQLiteUpdate> = T['_']['returning'] extends undefined ? T['_']['runResult']\n\t: T['_']['returning'][];\n\nexport type SQLiteUpdatePrepare<T extends AnySQLiteUpdate> = SQLitePreparedQuery<\n\t{\n\t\ttype: T['_']['resultType'];\n\t\trun: T['_']['runResult'];\n\t\tall: T['_']['returning'] extends undefined ? DrizzleTypeError<'.all() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'][];\n\t\tget: T['_']['returning'] extends undefined ? DrizzleTypeError<'.get() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'];\n\t\tvalues: T['_']['returning'] extends undefined ? DrizzleTypeError<'.values() cannot be used without .returning()'>\n\t\t\t: any[][];\n\t\texecute: SQLiteUpdateExecute<T>;\n\t}\n>;\n\nexport type SQLiteUpdateDynamic<T extends AnySQLiteUpdate> = SQLiteUpdate<\n\tT['_']['table'],\n\tT['_']['resultType'],\n\tT['_']['runResult'],\n\tT['_']['returning']\n>;\n\nexport type SQLiteUpdate<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = any,\n\tTReturning extends Record<string, unknown> | undefined = Record<string, unknown> | undefined,\n> = SQLiteUpdateBase<TTable, TResultType, TRunResult, TReturning, true, never>;\n\ntype AnySQLiteUpdate = SQLiteUpdateBase<any, any, any, any, any, any>;\n\nexport interface SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n> extends SQLWrapper, QueryPromise<TReturning extends undefined ? TRunResult : TReturning[]> {\n\treadonly _: {\n\t\treadonly dialect: 'sqlite';\n\t\treadonly table: TTable;\n\t\treadonly resultType: TResultType;\n\t\treadonly runResult: TRunResult;\n\t\treadonly returning: TReturning;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TReturning extends undefined ? TRunResult : TReturning[];\n\t};\n}\n\nexport class SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTDynamic extends boolean = false,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTExcludedMethods extends string = never,\n> extends QueryPromise<TReturning extends undefined ? TRunResult : TReturning[]>\n\timplements RunnableQuery<TReturning extends undefined ? TRunResult : TReturning[], 'sqlite'>, SQLWrapper\n{\n\tstatic readonly [entityKind]: string = 'SQLiteUpdate';\n\n\t/** @internal */\n\tconfig: SQLiteUpdateConfig;\n\n\tconstructor(\n\t\ttable: TTable,\n\t\tset: UpdateSet,\n\t\tprivate session: SQLiteSession<any, any, any, any>,\n\t\tprivate dialect: SQLiteDialect,\n\t) {\n\t\tsuper();\n\t\tthis.config = { set, table };\n\t}\n\n\twhere(where: SQL | undefined): SQLiteUpdateWithout<this, TDynamic, 'where'> {\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\treturning(): SQLiteUpdateReturningAll<this, TDynamic>;\n\treturning<TSelectedFields extends SelectedFields>(\n\t\tfields: TSelectedFields,\n\t): SQLiteUpdateReturning<this, TDynamic, TSelectedFields>;\n\treturning(\n\t\tfields: SelectedFields = this.config.table[SQLiteTable.Symbol.Columns],\n\t): SQLiteUpdateWithout<AnySQLiteUpdate, TDynamic, 'returning'> {\n\t\tthis.config.returning = orderSelectedFields(fields);\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildUpdateQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\tprepare(isOneTimeQuery?: boolean): SQLiteUpdatePrepare<this> {\n\t\treturn this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](\n\t\t\tthis.dialect.sqlToQuery(this.getSQL()),\n\t\t\tthis.config.returning,\n\t\t\tthis.config.returning ? 'all' : 'run',\n\t\t) as SQLiteUpdatePrepare<this>;\n\t}\n\n\trun: ReturnType<this['prepare']>['run'] = (placeholderValues) => {\n\t\treturn this.prepare(true).run(placeholderValues);\n\t};\n\n\tall: ReturnType<this['prepare']>['all'] = (placeholderValues) => {\n\t\treturn this.prepare(true).all(placeholderValues);\n\t};\n\n\tget: ReturnType<this['prepare']>['get'] = (placeholderValues) => {\n\t\treturn this.prepare(true).get(placeholderValues);\n\t};\n\n\tvalues: ReturnType<this['prepare']>['values'] = (placeholderValues) => {\n\t\treturn this.prepare(true).values(placeholderValues);\n\t};\n\n\toverride async execute(): Promise<SQLiteUpdateExecute<this>> {\n\t\treturn (this.config.returning ? this.all() : this.run()) as SQLiteUpdateExecute<this>;\n\t}\n\n\t$dynamic(): SQLiteUpdateDynamic<this> {\n\t\treturn this as any;\n\t}\n}\n"],"mappings":"AACA,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAK7B,SAAS,mBAAmB;AAC5B,SAAgC,cAAc,2BAA2C;AAkBlF,MAAM,oBAIX;AAAA,EAOD,YACW,OACA,SACA,SACT;AAHS;AACA;AACA;AAAA,EACR;AAAA,EAVH,QAAiB,UAAU,IAA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EAChD;AAAA,EAEA,SAAgD,CAAC,sBAAsB;AACtE,WAAO,KAAK,QAAQ,IAAI,EAAE,OAAO,iBAAiB;AAAA,EACnD;AAAA,EAEA,MAAe,UAA8C;AAC5D,WAAQ,KAAK,OAAO,YAAY,KAAK,IAAI,IAAI,KAAK,IAAI;AAAA,EACvD;AAAA,EAEA,WAAsC;AACrC,WAAO;AAAA,EACR;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/sqlite-core/query-builders/update.ts"],"sourcesContent":["import type { GetColumnData } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { SelectResultFields } from '~/query-builders/select.types.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport type { Query, SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { SQLiteDialect } from '~/sqlite-core/dialect.ts';\nimport type { SQLitePreparedQuery, SQLiteSession } from '~/sqlite-core/session.ts';\nimport { SQLiteTable } from '~/sqlite-core/table.ts';\nimport { type DrizzleTypeError, mapUpdateSet, orderSelectedFields, type UpdateSet } from '~/utils.ts';\nimport type { SelectedFields, SelectedFieldsOrdered } from './select.types.ts';\nimport type { SQLiteColumn } from '../columns/common.ts';\n\nexport interface SQLiteUpdateConfig {\n\twhere?: SQL | undefined;\n\tset: UpdateSet;\n\ttable: SQLiteTable;\n\treturning?: SelectedFieldsOrdered;\n}\n\nexport type SQLiteUpdateSetSource<TTable extends SQLiteTable> =\n\t& {\n\t\t[Key in keyof TTable['_']['columns']]?:\n\t\t\t| GetColumnData<TTable['_']['columns'][Key], 'query'>\n\t\t\t| SQL;\n\t}\n\t& {};\n\nexport class SQLiteUpdateBuilder<\n\tTTable extends SQLiteTable,\n\tTResultType extends 'sync' | 'async',\n\tTRunResult,\n> {\n\tstatic readonly [entityKind]: string = 'SQLiteUpdateBuilder';\n\n\tdeclare readonly _: {\n\t\treadonly table: TTable;\n\t};\n\n\tconstructor(\n\t\tprotected table: TTable,\n\t\tprotected session: SQLiteSession<any, any, any, any>,\n\t\tprotected dialect: SQLiteDialect,\n\t) {}\n\n\tset(values: SQLiteUpdateSetSource<TTable>): SQLiteUpdateBase<TTable, TResultType, TRunResult> {\n\t\treturn new SQLiteUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect);\n\t}\n}\n\nexport type SQLiteUpdateWithout<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tK extends keyof T & string,\n> = TDynamic extends true ? T : Omit<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['returning'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods'] | K\n\t>,\n\tT['_']['excludedMethods'] | K\n>;\n\nexport type SQLiteUpdateReturningAll<T extends AnySQLiteUpdate, TDynamic extends boolean> = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tT['_']['table']['$inferSelect'],\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateReturning<\n\tT extends AnySQLiteUpdate,\n\tTDynamic extends boolean,\n\tTSelectedFields extends SelectedFields,\n> = SQLiteUpdateWithout<\n\tSQLiteUpdateBase<\n\t\tT['_']['table'],\n\t\tT['_']['resultType'],\n\t\tT['_']['runResult'],\n\t\tSelectResultFields<TSelectedFields>,\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>,\n\tTDynamic,\n\t'returning'\n>;\n\nexport type SQLiteUpdateExecute<T extends AnySQLiteUpdate> = T['_']['returning'] extends undefined ? T['_']['runResult']\n\t: T['_']['returning'][];\n\nexport type SQLiteUpdatePrepare<T extends AnySQLiteUpdate> = SQLitePreparedQuery<\n\t{\n\t\ttype: T['_']['resultType'];\n\t\trun: T['_']['runResult'];\n\t\tall: T['_']['returning'] extends undefined ? DrizzleTypeError<'.all() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'][];\n\t\tget: T['_']['returning'] extends undefined ? DrizzleTypeError<'.get() cannot be used without .returning()'>\n\t\t\t: T['_']['returning'];\n\t\tvalues: T['_']['returning'] extends undefined ? DrizzleTypeError<'.values() cannot be used without .returning()'>\n\t\t\t: any[][];\n\t\texecute: SQLiteUpdateExecute<T>;\n\t}\n>;\n\nexport type SQLiteUpdateDynamic<T extends AnySQLiteUpdate> = SQLiteUpdate<\n\tT['_']['table'],\n\tT['_']['resultType'],\n\tT['_']['runResult'],\n\tT['_']['returning']\n>;\n\nexport type SQLiteUpdate<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = any,\n\tTReturning extends Record<string, unknown> | undefined = Record<string, unknown> | undefined,\n> = SQLiteUpdateBase<TTable, TResultType, TRunResult, TReturning, true, never>;\n\ntype AnySQLiteUpdate = SQLiteUpdateBase<any, any, any, any, any, any>;\n\nexport interface SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n> extends SQLWrapper, QueryPromise<TReturning extends undefined ? TRunResult : TReturning[]> {\n\treadonly _: {\n\t\treadonly dialect: 'sqlite';\n\t\treadonly table: TTable;\n\t\treadonly resultType: TResultType;\n\t\treadonly runResult: TRunResult;\n\t\treadonly returning: TReturning;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TReturning extends undefined ? TRunResult : TReturning[];\n\t};\n}\n\nexport class SQLiteUpdateBase<\n\tTTable extends SQLiteTable = SQLiteTable,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTResultType extends 'sync' | 'async' = 'sync' | 'async',\n\tTRunResult = unknown,\n\tTReturning = undefined,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTDynamic extends boolean = false,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tTExcludedMethods extends string = never,\n> extends QueryPromise<TReturning extends undefined ? TRunResult : TReturning[]>\n\timplements RunnableQuery<TReturning extends undefined ? TRunResult : TReturning[], 'sqlite'>, SQLWrapper\n{\n\tstatic readonly [entityKind]: string = 'SQLiteUpdate';\n\n\t/** @internal */\n\tconfig: SQLiteUpdateConfig;\n\n\tconstructor(\n\t\ttable: TTable,\n\t\tset: UpdateSet,\n\t\tprivate session: SQLiteSession<any, any, any, any>,\n\t\tprivate dialect: SQLiteDialect,\n\t) {\n\t\tsuper();\n\t\tthis.config = { set, table };\n\t}\n\n\t/**\n\t * Adds a 'where' clause to the query.\n\t * \n\t * Calling this method will update only those rows that fulfill a specified condition.\n\t * \n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t * \n\t * @param where the 'where' clause.\n\t * \n\t * @example\n\t * You can use conditional operators and `sql function` to filter the rows to be updated.\n\t * \n\t * ```ts\n\t * // Update all cars with green color\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(eq(cars.color, 'green'));\n\t * // or\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(sql`${cars.color} = 'green'`)\n\t * ```\n\t * \n\t * You can logically combine conditional operators with `and()` and `or()` operators:\n\t * \n\t * ```ts\n\t * // Update all BMW cars with a green color\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));\n\t * \n\t * // Update all cars with the green or blue color\n\t * db.update(cars).set({ color: 'red' })\n\t * .where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));\n\t * ```\n\t */\n\twhere(where: SQL | undefined): SQLiteUpdateWithout<this, TDynamic, 'where'> {\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `returning` clause to the query.\n\t * \n\t * Calling this method will return the specified fields of the updated rows. If no fields are specified, all fields will be returned.\n\t * \n\t * See docs: {@link https://orm.drizzle.team/docs/update#update-with-returning}\n\t * \n\t * @example\n\t * ```ts\n\t * // Update all cars with the green color and return all fields\n\t * const updatedCars: Car[] = await db.update(cars)\n\t * .set({ color: 'red' })\n\t * .where(eq(cars.color, 'green'))\n\t * .returning();\n\t * \n\t * // Update all cars with the green color and return only their id and brand fields\n\t * const updatedCarsIdsAndBrands: { id: number, brand: string }[] = await db.update(cars)\n\t * .set({ color: 'red' })\n\t * .where(eq(cars.color, 'green'))\n\t * .returning({ id: cars.id, brand: cars.brand });\n\t * ```\n\t */\n\treturning(): SQLiteUpdateReturningAll<this, TDynamic>;\n\treturning<TSelectedFields extends SelectedFields>(\n\t\tfields: TSelectedFields,\n\t): SQLiteUpdateReturning<this, TDynamic, TSelectedFields>;\n\treturning(\n\t\tfields: SelectedFields = this.config.table[SQLiteTable.Symbol.Columns],\n\t): SQLiteUpdateWithout<AnySQLiteUpdate, TDynamic, 'returning'> {\n\t\tthis.config.returning = orderSelectedFields<SQLiteColumn>(fields);\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildUpdateQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\tprepare(isOneTimeQuery?: boolean): SQLiteUpdatePrepare<this> {\n\t\treturn this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](\n\t\t\tthis.dialect.sqlToQuery(this.getSQL()),\n\t\t\tthis.config.returning,\n\t\t\tthis.config.returning ? 'all' : 'run',\n\t\t) as SQLiteUpdatePrepare<this>;\n\t}\n\n\trun: ReturnType<this['prepare']>['run'] = (placeholderValues) => {\n\t\treturn this.prepare(true).run(placeholderValues);\n\t};\n\n\tall: ReturnType<this['prepare']>['all'] = (placeholderValues) => {\n\t\treturn this.prepare(true).all(placeholderValues);\n\t};\n\n\tget: ReturnType<this['prepare']>['get'] = (placeholderValues) => {\n\t\treturn this.prepare(true).get(placeholderValues);\n\t};\n\n\tvalues: ReturnType<this['prepare']>['values'] = (placeholderValues) => {\n\t\treturn this.prepare(true).values(placeholderValues);\n\t};\n\n\toverride async execute(): Promise<SQLiteUpdateExecute<this>> {\n\t\treturn (this.config.returning ? this.all() : this.run()) as SQLiteUpdateExecute<this>;\n\t}\n\n\t$dynamic(): SQLiteUpdateDynamic<this> {\n\t\treturn this as any;\n\t}\n}\n"],"mappings":"AACA,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAK7B,SAAS,mBAAmB;AAC5B,SAAgC,cAAc,2BAA2C;AAmBlF,MAAM,oBAIX;AAAA,EAOD,YACW,OACA,SACA,SACT;AAHS;AACA;AACA;AAAA,EACR;AAAA,EAVH,QAAiB,UAAU,IAAY;AAAA,EAYvC,IAAI,QAA0F;AAC7F,WAAO,IAAI,iBAAiB,KAAK,OAAO,aAAa,KAAK,OAAO,MAAM,GAAG,KAAK,SAAS,KAAK,OAAO;AAAA,EACrG;AACD;AAqGO,MAAM,yBAUH,aAEV;AAAA,EAMC,YACC,OACA,KACQ,SACA,SACP;AACD,UAAM;AAHE;AACA;AAGR,SAAK,SAAS,EAAE,KAAK,MAAM;AAAA,EAC5B;AAAA,EAbA,QAAiB,UAAU,IAAY;AAAA;AAAA,EAGvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6CA,MAAM,OAAsE;AAC3E,SAAK,OAAO,QAAQ;AACpB,WAAO;AAAA,EACR;AAAA,EA4BA,UACC,SAAyB,KAAK,OAAO,MAAM,YAAY,OAAO,OAAO,GACP;AAC9D,SAAK,OAAO,YAAY,oBAAkC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