drizzle-orm 0.28.3 → 0.28.4
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/{alias-d302772a.mjs → alias-e80df77c.mjs} +2302 -2299
- package/alias-e80df77c.mjs.map +1 -0
- package/alias.d.cts +31 -0
- package/alias.d.mts +31 -0
- package/alias.d.ts +7 -7
- package/aws-data-api/common/index.d.cts +9 -0
- package/aws-data-api/common/index.d.mts +9 -0
- package/aws-data-api/common/index.d.ts +1 -1
- package/aws-data-api/pg/driver.d.cts +23 -0
- package/aws-data-api/pg/driver.d.mts +23 -0
- package/aws-data-api/pg/driver.d.ts +6 -6
- package/aws-data-api/pg/index.cjs +17 -17
- package/aws-data-api/pg/index.d.cts +2 -0
- package/aws-data-api/pg/index.d.mts +2 -0
- package/aws-data-api/pg/index.d.ts +2 -2
- package/aws-data-api/pg/index.mjs +3 -2
- package/aws-data-api/pg/index.mjs.map +1 -1
- package/aws-data-api/pg/migrator.d.cts +3 -0
- package/aws-data-api/pg/migrator.d.mts +3 -0
- package/aws-data-api/pg/migrator.d.ts +2 -2
- package/aws-data-api/pg/session.d.cts +50 -0
- package/aws-data-api/pg/session.d.mts +50 -0
- package/aws-data-api/pg/session.d.ts +6 -6
- package/better-sqlite3/driver.d.cts +5 -0
- package/better-sqlite3/driver.d.mts +5 -0
- package/better-sqlite3/driver.d.ts +2 -2
- package/better-sqlite3/index.cjs +16 -16
- package/better-sqlite3/index.d.cts +2 -0
- package/better-sqlite3/index.d.mts +2 -0
- package/better-sqlite3/index.d.ts +2 -2
- package/better-sqlite3/index.mjs +3 -2
- package/better-sqlite3/index.mjs.map +1 -1
- package/better-sqlite3/migrator.d.cts +3 -0
- package/better-sqlite3/migrator.d.mts +3 -0
- package/better-sqlite3/migrator.d.ts +2 -2
- package/better-sqlite3/session.d.cts +48 -0
- package/better-sqlite3/session.d.mts +48 -0
- package/better-sqlite3/session.d.ts +8 -8
- package/bun-sqlite/driver.d.cts +6 -0
- package/bun-sqlite/driver.d.mts +6 -0
- package/bun-sqlite/driver.d.ts +2 -2
- package/bun-sqlite/index.cjs +16 -16
- package/bun-sqlite/index.d.cts +2 -0
- package/bun-sqlite/index.d.mts +2 -0
- package/bun-sqlite/index.d.ts +2 -2
- package/bun-sqlite/index.mjs +3 -2
- package/bun-sqlite/index.mjs.map +1 -1
- package/bun-sqlite/migrator.d.cts +3 -0
- package/bun-sqlite/migrator.d.mts +3 -0
- package/bun-sqlite/migrator.d.ts +2 -2
- package/bun-sqlite/session.d.cts +52 -0
- package/bun-sqlite/session.d.mts +52 -0
- package/bun-sqlite/session.d.ts +9 -9
- package/column-builder.d.cts +146 -0
- package/column-builder.d.mts +146 -0
- package/column-builder.d.ts +22 -20
- package/column.d.cts +56 -0
- package/column.d.mts +56 -0
- package/column.d.ts +5 -5
- package/d1/driver.d.cts +5 -0
- package/d1/driver.d.mts +5 -0
- package/d1/driver.d.ts +2 -2
- package/d1/index.cjs +19 -19
- package/d1/index.d.cts +2 -0
- package/d1/index.d.mts +2 -0
- package/d1/index.d.ts +2 -2
- package/d1/index.mjs +3 -2
- package/d1/index.mjs.map +1 -1
- package/d1/migrator.d.cts +3 -0
- package/d1/migrator.d.mts +3 -0
- package/d1/migrator.d.ts +2 -2
- package/d1/session.d.cts +50 -0
- package/d1/session.d.mts +50 -0
- package/d1/session.d.ts +9 -9
- package/entity.d.cts +7 -0
- package/entity.d.mts +7 -0
- package/errors.d.cts +10 -0
- package/errors.d.mts +10 -0
- package/errors.d.ts +1 -1
- package/expressions.d.cts +1 -0
- package/expressions.d.mts +1 -0
- package/expressions.d.ts +1 -1
- package/{alias-58b7b8c9.cjs → index-b1dbb7ec.cjs} +3071 -3030
- package/index-b1dbb7ec.cjs.map +1 -0
- package/index.cjs +100 -132
- package/index.cjs.map +1 -1
- package/index.d.cts +15 -0
- package/index.d.mts +15 -0
- package/index.d.ts +15 -15
- package/index.mjs +3 -2
- package/index.mjs.map +1 -1
- package/knex/index.d.cts +9 -0
- package/knex/index.d.mts +9 -0
- package/knex/index.d.ts +5 -5
- package/kysely/index.d.cts +16 -0
- package/kysely/index.d.mts +16 -0
- package/kysely/index.d.ts +7 -7
- package/libsql/driver.d.cts +5 -0
- package/libsql/driver.d.mts +5 -0
- package/libsql/driver.d.ts +2 -2
- package/libsql/index.cjs +17 -16
- package/libsql/index.cjs.map +1 -1
- package/libsql/index.d.cts +2 -0
- package/libsql/index.d.mts +2 -0
- package/libsql/index.d.ts +2 -2
- package/libsql/index.mjs +4 -2
- package/libsql/index.mjs.map +1 -1
- package/libsql/migrator.d.cts +3 -0
- package/libsql/migrator.d.mts +3 -0
- package/libsql/migrator.d.ts +2 -2
- package/libsql/session.d.cts +53 -0
- package/libsql/session.d.mts +53 -0
- package/libsql/session.d.ts +9 -9
- package/logger.d.cts +23 -0
- package/logger.d.mts +23 -0
- package/logger.d.ts +1 -1
- package/migrator.d.cts +15 -0
- package/migrator.d.mts +15 -0
- package/mysql-core/alias.d.cts +4 -0
- package/mysql-core/alias.d.mts +4 -0
- package/mysql-core/alias.d.ts +3 -3
- package/mysql-core/checks.d.cts +18 -0
- package/mysql-core/checks.d.mts +18 -0
- package/mysql-core/checks.d.ts +3 -3
- package/mysql-core/columns/bigint.d.cts +43 -0
- package/mysql-core/columns/bigint.d.mts +43 -0
- package/mysql-core/columns/bigint.d.ts +4 -4
- package/mysql-core/columns/binary.d.cts +25 -0
- package/mysql-core/columns/binary.d.mts +25 -0
- package/mysql-core/columns/binary.d.ts +4 -4
- package/mysql-core/columns/boolean.d.cts +22 -0
- package/mysql-core/columns/boolean.d.mts +22 -0
- package/mysql-core/columns/boolean.d.ts +4 -4
- package/mysql-core/columns/char.d.cts +28 -0
- package/mysql-core/columns/char.d.mts +28 -0
- package/mysql-core/columns/char.d.ts +5 -5
- package/mysql-core/columns/common.d.cts +49 -0
- package/mysql-core/columns/common.d.mts +49 -0
- package/mysql-core/columns/common.d.ts +13 -9
- package/mysql-core/columns/custom.d.cts +148 -0
- package/mysql-core/columns/custom.d.mts +148 -0
- package/mysql-core/columns/custom.d.ts +7 -7
- package/mysql-core/columns/date.common.d.cts +16 -0
- package/mysql-core/columns/date.common.d.mts +16 -0
- package/mysql-core/columns/date.common.d.ts +4 -4
- package/mysql-core/columns/date.d.cts +49 -0
- package/mysql-core/columns/date.d.mts +49 -0
- package/mysql-core/columns/date.d.ts +6 -6
- package/mysql-core/columns/datetime.d.cts +53 -0
- package/mysql-core/columns/datetime.d.mts +53 -0
- package/mysql-core/columns/datetime.d.ts +6 -6
- package/mysql-core/columns/decimal.d.cts +27 -0
- package/mysql-core/columns/decimal.d.mts +27 -0
- package/mysql-core/columns/decimal.d.ts +4 -4
- package/mysql-core/columns/double.d.cts +27 -0
- package/mysql-core/columns/double.d.mts +27 -0
- package/mysql-core/columns/double.d.ts +4 -4
- package/mysql-core/columns/enum.d.cts +27 -0
- package/mysql-core/columns/enum.d.mts +27 -0
- package/mysql-core/columns/enum.d.ts +5 -5
- package/mysql-core/columns/float.d.cts +21 -0
- package/mysql-core/columns/float.d.mts +21 -0
- package/mysql-core/columns/float.d.ts +4 -4
- package/mysql-core/columns/index.d.cts +25 -0
- package/mysql-core/columns/index.d.mts +25 -0
- package/mysql-core/columns/index.d.ts +25 -25
- package/mysql-core/columns/int.d.cts +22 -0
- package/mysql-core/columns/int.d.mts +22 -0
- package/mysql-core/columns/int.d.ts +4 -4
- package/mysql-core/columns/json.d.cts +22 -0
- package/mysql-core/columns/json.d.mts +22 -0
- package/mysql-core/columns/json.d.ts +4 -4
- package/mysql-core/columns/mediumint.d.cts +22 -0
- package/mysql-core/columns/mediumint.d.mts +22 -0
- package/mysql-core/columns/mediumint.d.ts +4 -4
- package/mysql-core/columns/real.d.cts +27 -0
- package/mysql-core/columns/real.d.mts +27 -0
- package/mysql-core/columns/real.d.ts +4 -4
- package/mysql-core/columns/serial.d.cts +22 -0
- package/mysql-core/columns/serial.d.mts +22 -0
- package/mysql-core/columns/serial.d.ts +4 -4
- package/mysql-core/columns/smallint.d.cts +22 -0
- package/mysql-core/columns/smallint.d.mts +22 -0
- package/mysql-core/columns/smallint.d.ts +4 -4
- package/mysql-core/columns/text.d.cts +37 -0
- package/mysql-core/columns/text.d.mts +37 -0
- package/mysql-core/columns/text.d.ts +5 -5
- package/mysql-core/columns/time.d.cts +25 -0
- package/mysql-core/columns/time.d.mts +25 -0
- package/mysql-core/columns/time.d.ts +4 -4
- package/mysql-core/columns/timestamp.d.cts +47 -0
- package/mysql-core/columns/timestamp.d.mts +47 -0
- package/mysql-core/columns/timestamp.d.ts +5 -5
- package/mysql-core/columns/tinyint.d.cts +22 -0
- package/mysql-core/columns/tinyint.d.mts +22 -0
- package/mysql-core/columns/tinyint.d.ts +4 -4
- package/mysql-core/columns/varbinary.d.cts +24 -0
- package/mysql-core/columns/varbinary.d.mts +24 -0
- package/mysql-core/columns/varbinary.d.ts +4 -4
- package/mysql-core/columns/varchar.d.cts +27 -0
- package/mysql-core/columns/varchar.d.mts +27 -0
- package/mysql-core/columns/varchar.d.ts +5 -5
- package/mysql-core/columns/year.d.cts +21 -0
- package/mysql-core/columns/year.d.mts +21 -0
- package/mysql-core/columns/year.d.ts +4 -4
- package/mysql-core/db.d.cts +55 -0
- package/mysql-core/db.d.mts +55 -0
- package/mysql-core/db.d.ts +14 -14
- package/mysql-core/dialect.d.cts +59 -0
- package/mysql-core/dialect.d.mts +59 -0
- package/mysql-core/dialect.d.ts +12 -12
- package/mysql-core/expressions.d.cts +8 -0
- package/mysql-core/expressions.d.mts +8 -0
- package/mysql-core/expressions.d.ts +3 -3
- package/mysql-core/foreign-keys.d.cts +48 -0
- package/mysql-core/foreign-keys.d.mts +48 -0
- package/mysql-core/foreign-keys.d.ts +3 -3
- package/mysql-core/index.cjs +156 -1028
- package/mysql-core/index.cjs.map +1 -1
- package/mysql-core/index.d.cts +16 -0
- package/mysql-core/index.d.mts +16 -0
- package/mysql-core/index.d.ts +16 -16
- package/mysql-core/index.mjs +37 -36
- package/mysql-core/index.mjs.map +1 -1
- package/mysql-core/indexes.d.cts +59 -0
- package/mysql-core/indexes.d.mts +59 -0
- package/mysql-core/indexes.d.ts +4 -4
- package/mysql-core/primary-keys.d.cts +17 -0
- package/mysql-core/primary-keys.d.mts +17 -0
- package/mysql-core/primary-keys.d.ts +3 -3
- package/mysql-core/query-builders/delete.d.cts +39 -0
- package/mysql-core/query-builders/delete.d.mts +39 -0
- package/mysql-core/query-builders/delete.d.ts +9 -9
- package/mysql-core/query-builders/index.d.cts +6 -0
- package/mysql-core/query-builders/index.d.mts +6 -0
- package/mysql-core/query-builders/index.d.ts +6 -6
- package/mysql-core/query-builders/insert.d.cts +59 -0
- package/mysql-core/query-builders/insert.d.mts +59 -0
- package/mysql-core/query-builders/insert.d.ts +11 -11
- package/mysql-core/query-builders/query-builder.d.cts +29 -0
- package/mysql-core/query-builders/query-builder.d.mts +29 -0
- package/mysql-core/query-builders/query-builder.d.ts +7 -7
- package/mysql-core/query-builders/query.d.cts +44 -0
- package/mysql-core/query-builders/query.d.mts +44 -0
- package/mysql-core/query-builders/query.d.ts +9 -9
- package/mysql-core/query-builders/select.d.cts +92 -0
- package/mysql-core/query-builders/select.d.mts +92 -0
- package/mysql-core/query-builders/select.d.ts +17 -17
- package/mysql-core/query-builders/select.types.d.cts +77 -0
- package/mysql-core/query-builders/select.types.d.mts +77 -0
- package/mysql-core/query-builders/select.types.d.ts +12 -12
- package/mysql-core/query-builders/update.d.cts +54 -0
- package/mysql-core/query-builders/update.d.mts +54 -0
- package/mysql-core/query-builders/update.d.ts +11 -11
- package/mysql-core/schema.d.cts +24 -0
- package/mysql-core/schema.d.mts +24 -0
- package/mysql-core/schema.d.ts +3 -3
- package/mysql-core/session.d.cts +63 -0
- package/mysql-core/session.d.mts +63 -0
- package/mysql-core/session.d.ts +7 -7
- package/mysql-core/subquery.d.cts +6 -0
- package/mysql-core/subquery.d.mts +6 -0
- package/mysql-core/subquery.d.ts +4 -4
- package/mysql-core/table.d.cts +35 -0
- package/mysql-core/table.d.mts +35 -0
- package/mysql-core/table.d.ts +11 -11
- package/mysql-core/unique-constraint.d.cts +24 -0
- package/mysql-core/unique-constraint.d.mts +24 -0
- package/mysql-core/unique-constraint.d.ts +3 -3
- package/mysql-core/utils.d.cts +32 -0
- package/mysql-core/utils.d.mts +32 -0
- package/mysql-core/utils.d.ts +11 -11
- package/mysql-core/view.d.cts +73 -0
- package/mysql-core/view.d.mts +73 -0
- package/mysql-core/view.d.ts +11 -11
- package/mysql2/driver.d.cts +31 -0
- package/mysql2/driver.d.mts +31 -0
- package/mysql2/driver.d.ts +10 -10
- package/mysql2/index.cjs +29 -27
- package/mysql2/index.cjs.map +1 -1
- package/mysql2/index.d.cts +2 -0
- package/mysql2/index.d.mts +2 -0
- package/mysql2/index.d.ts +2 -2
- package/mysql2/index.mjs +5 -2
- package/mysql2/index.mjs.map +1 -1
- package/mysql2/migrator.d.cts +3 -0
- package/mysql2/migrator.d.mts +3 -0
- package/mysql2/migrator.d.ts +2 -2
- package/mysql2/session.d.cts +52 -0
- package/mysql2/session.d.mts +52 -0
- package/mysql2/session.d.ts +8 -8
- package/neon-http/driver.d.cts +21 -0
- package/neon-http/driver.d.mts +21 -0
- package/neon-http/driver.d.ts +7 -7
- package/neon-http/index.cjs +16 -16
- package/neon-http/index.d.cts +2 -0
- package/neon-http/index.d.mts +2 -0
- package/neon-http/index.d.ts +2 -2
- package/neon-http/index.mjs +3 -2
- package/neon-http/index.mjs.map +1 -1
- package/neon-http/migrator.cjs +9 -6
- package/neon-http/migrator.cjs.map +1 -1
- package/neon-http/migrator.d.cts +11 -0
- package/neon-http/migrator.d.mts +11 -0
- package/neon-http/migrator.d.ts +2 -2
- package/neon-http/migrator.mjs +3 -1
- package/neon-http/migrator.mjs.map +1 -1
- package/neon-http/session.d.cts +55 -0
- package/neon-http/session.d.mts +55 -0
- package/neon-http/session.d.ts +10 -10
- package/neon-serverless/driver.d.cts +22 -0
- package/neon-serverless/driver.d.mts +22 -0
- package/neon-serverless/driver.d.ts +8 -8
- package/neon-serverless/index.cjs +22 -22
- package/neon-serverless/index.d.cts +2 -0
- package/neon-serverless/index.d.mts +2 -0
- package/neon-serverless/index.d.ts +2 -2
- package/neon-serverless/index.mjs +3 -2
- package/neon-serverless/index.mjs.map +1 -1
- package/neon-serverless/migrator.d.cts +3 -0
- package/neon-serverless/migrator.d.mts +3 -0
- package/neon-serverless/migrator.d.ts +2 -2
- package/neon-serverless/session.d.cts +48 -0
- package/neon-serverless/session.d.mts +48 -0
- package/neon-serverless/session.d.ts +10 -10
- package/node-postgres/driver.d.cts +22 -0
- package/node-postgres/driver.d.mts +22 -0
- package/node-postgres/driver.d.ts +8 -8
- package/node-postgres/index.cjs +27 -27
- package/node-postgres/index.d.cts +2 -0
- package/node-postgres/index.d.mts +2 -0
- package/node-postgres/index.d.ts +2 -2
- package/node-postgres/index.mjs +3 -2
- package/node-postgres/index.mjs.map +1 -1
- package/node-postgres/migrator.d.cts +3 -0
- package/node-postgres/migrator.d.mts +3 -0
- package/node-postgres/migrator.d.ts +2 -2
- package/node-postgres/session.d.cts +46 -0
- package/node-postgres/session.d.mts +46 -0
- package/node-postgres/session.d.ts +10 -10
- package/operations.d.cts +15 -0
- package/operations.d.mts +15 -0
- package/operations.d.ts +3 -3
- package/package.json +291 -74
- package/pg-core/alias.d.cts +4 -0
- package/pg-core/alias.d.mts +4 -0
- package/pg-core/alias.d.ts +3 -3
- package/pg-core/checks.d.cts +18 -0
- package/pg-core/checks.d.mts +18 -0
- package/pg-core/checks.d.ts +3 -3
- package/pg-core/columns/array.d.cts +26 -0
- package/pg-core/columns/array.d.mts +26 -0
- package/pg-core/columns/array.d.ts +5 -5
- package/pg-core/columns/bigint.d.cts +43 -0
- package/pg-core/columns/bigint.d.mts +43 -0
- package/pg-core/columns/bigint.d.ts +4 -4
- package/pg-core/columns/bigserial.d.cts +43 -0
- package/pg-core/columns/bigserial.d.mts +43 -0
- package/pg-core/columns/bigserial.d.ts +4 -4
- package/pg-core/columns/boolean.d.cts +21 -0
- package/pg-core/columns/boolean.d.mts +21 -0
- package/pg-core/columns/boolean.d.ts +4 -4
- package/pg-core/columns/char.d.cts +34 -0
- package/pg-core/columns/char.d.mts +34 -0
- package/pg-core/columns/char.d.ts +5 -5
- package/pg-core/columns/cidr.d.cts +21 -0
- package/pg-core/columns/cidr.d.mts +21 -0
- package/pg-core/columns/cidr.d.ts +4 -4
- package/pg-core/columns/common.d.cts +54 -0
- package/pg-core/columns/common.d.mts +54 -0
- package/pg-core/columns/common.d.ts +15 -13
- package/pg-core/columns/custom.d.cts +148 -0
- package/pg-core/columns/custom.d.mts +148 -0
- package/pg-core/columns/custom.d.ts +7 -7
- package/pg-core/columns/date.common.d.cts +7 -0
- package/pg-core/columns/date.common.d.mts +7 -0
- package/pg-core/columns/date.common.d.ts +4 -4
- package/pg-core/columns/date.d.cts +45 -0
- package/pg-core/columns/date.d.mts +45 -0
- package/pg-core/columns/date.d.ts +5 -5
- package/pg-core/columns/double-precision.d.cts +22 -0
- package/pg-core/columns/double-precision.d.mts +22 -0
- package/pg-core/columns/double-precision.d.ts +4 -4
- package/pg-core/columns/enum.d.cts +42 -0
- package/pg-core/columns/enum.d.mts +42 -0
- package/pg-core/columns/enum.d.ts +6 -6
- package/pg-core/columns/index.d.cts +28 -0
- package/pg-core/columns/index.d.mts +28 -0
- package/pg-core/columns/index.d.ts +28 -28
- package/pg-core/columns/inet.d.cts +21 -0
- package/pg-core/columns/inet.d.mts +21 -0
- package/pg-core/columns/inet.d.ts +4 -4
- package/pg-core/columns/integer.d.cts +23 -0
- package/pg-core/columns/integer.d.mts +23 -0
- package/pg-core/columns/integer.d.ts +4 -4
- package/pg-core/columns/interval.d.cts +32 -0
- package/pg-core/columns/interval.d.mts +32 -0
- package/pg-core/columns/interval.d.ts +5 -5
- package/pg-core/columns/json.d.cts +27 -0
- package/pg-core/columns/json.d.mts +27 -0
- package/pg-core/columns/json.d.ts +5 -5
- package/pg-core/columns/jsonb.d.cts +27 -0
- package/pg-core/columns/jsonb.d.mts +27 -0
- package/pg-core/columns/jsonb.d.ts +5 -5
- package/pg-core/columns/macaddr.d.cts +21 -0
- package/pg-core/columns/macaddr.d.mts +21 -0
- package/pg-core/columns/macaddr.d.ts +4 -4
- package/pg-core/columns/macaddr8.d.cts +21 -0
- package/pg-core/columns/macaddr8.d.mts +21 -0
- package/pg-core/columns/macaddr8.d.ts +4 -4
- package/pg-core/columns/numeric.d.cts +40 -0
- package/pg-core/columns/numeric.d.mts +40 -0
- package/pg-core/columns/numeric.d.ts +5 -5
- package/pg-core/columns/real.d.cts +28 -0
- package/pg-core/columns/real.d.mts +28 -0
- package/pg-core/columns/real.d.ts +5 -5
- package/pg-core/columns/serial.d.cts +21 -0
- package/pg-core/columns/serial.d.mts +21 -0
- package/pg-core/columns/serial.d.ts +4 -4
- package/pg-core/columns/smallint.d.cts +22 -0
- package/pg-core/columns/smallint.d.mts +22 -0
- package/pg-core/columns/smallint.d.ts +4 -4
- package/pg-core/columns/smallserial.d.cts +21 -0
- package/pg-core/columns/smallserial.d.mts +21 -0
- package/pg-core/columns/smallserial.d.ts +4 -4
- package/pg-core/columns/text.d.cts +31 -0
- package/pg-core/columns/text.d.mts +31 -0
- package/pg-core/columns/text.d.ts +5 -5
- package/pg-core/columns/time.d.cts +38 -0
- package/pg-core/columns/time.d.mts +38 -0
- package/pg-core/columns/time.d.ts +7 -7
- package/pg-core/columns/timestamp.d.cts +64 -0
- package/pg-core/columns/timestamp.d.mts +64 -0
- package/pg-core/columns/timestamp.d.ts +7 -7
- package/pg-core/columns/uuid.d.cts +25 -0
- package/pg-core/columns/uuid.d.mts +25 -0
- package/pg-core/columns/uuid.d.ts +4 -4
- package/pg-core/columns/varchar.d.cts +34 -0
- package/pg-core/columns/varchar.d.mts +34 -0
- package/pg-core/columns/varchar.d.ts +5 -5
- package/pg-core/db.d.cts +53 -0
- package/pg-core/db.d.mts +53 -0
- package/pg-core/db.d.ts +17 -17
- package/pg-core/dialect.d.cts +53 -0
- package/pg-core/dialect.d.mts +53 -0
- package/pg-core/dialect.d.ts +11 -11
- package/pg-core/expressions.d.cts +8 -0
- package/pg-core/expressions.d.mts +8 -0
- package/pg-core/expressions.d.ts +3 -3
- package/pg-core/foreign-keys.d.cts +45 -0
- package/pg-core/foreign-keys.d.mts +45 -0
- package/pg-core/foreign-keys.d.ts +3 -3
- package/pg-core/index.cjs +158 -157
- package/pg-core/index.cjs.map +1 -1
- package/pg-core/index.d.cts +16 -0
- package/pg-core/index.d.mts +16 -0
- package/pg-core/index.d.ts +16 -16
- package/pg-core/index.mjs +8 -7
- package/pg-core/index.mjs.map +1 -1
- package/pg-core/indexes.d.cts +72 -0
- package/pg-core/indexes.d.mts +72 -0
- package/pg-core/indexes.d.ts +4 -4
- package/pg-core/primary-keys.d.cts +17 -0
- package/pg-core/primary-keys.d.mts +17 -0
- package/pg-core/primary-keys.d.ts +3 -3
- package/pg-core/query-builders/delete.d.cts +35 -0
- package/pg-core/query-builders/delete.d.mts +35 -0
- package/pg-core/query-builders/delete.d.ts +9 -9
- package/pg-core/query-builders/index.d.cts +7 -0
- package/pg-core/query-builders/index.d.mts +7 -0
- package/pg-core/query-builders/index.d.ts +7 -7
- package/pg-core/query-builders/insert.d.cts +63 -0
- package/pg-core/query-builders/insert.d.mts +63 -0
- package/pg-core/query-builders/insert.d.ts +12 -12
- package/pg-core/query-builders/query-builder.d.cts +37 -0
- package/pg-core/query-builders/query-builder.d.mts +37 -0
- package/pg-core/query-builders/query-builder.d.ts +9 -9
- package/pg-core/query-builders/query.d.cts +39 -0
- package/pg-core/query-builders/query.d.mts +39 -0
- package/pg-core/query-builders/query.d.ts +7 -7
- package/pg-core/query-builders/refresh-materialized-view.d.cts +26 -0
- package/pg-core/query-builders/refresh-materialized-view.d.mts +26 -0
- package/pg-core/query-builders/refresh-materialized-view.d.ts +6 -6
- package/pg-core/query-builders/select.d.cts +211 -0
- package/pg-core/query-builders/select.d.mts +211 -0
- package/pg-core/query-builders/select.d.ts +15 -15
- package/pg-core/query-builders/select.types.d.cts +79 -0
- package/pg-core/query-builders/select.types.d.mts +79 -0
- package/pg-core/query-builders/select.types.d.ts +11 -11
- package/pg-core/query-builders/update.d.cts +53 -0
- package/pg-core/query-builders/update.d.mts +53 -0
- package/pg-core/query-builders/update.d.ts +11 -11
- package/pg-core/schema.d.cts +13 -0
- package/pg-core/schema.d.mts +13 -0
- package/pg-core/schema.d.ts +3 -3
- package/pg-core/session.d.cts +54 -0
- package/pg-core/session.d.mts +54 -0
- package/pg-core/session.d.ts +6 -6
- package/pg-core/subquery.d.cts +5 -0
- package/pg-core/subquery.d.mts +5 -0
- package/pg-core/subquery.d.ts +3 -3
- package/pg-core/table.d.cts +28 -0
- package/pg-core/table.d.mts +28 -0
- package/pg-core/table.d.ts +10 -10
- package/pg-core/unique-constraint.d.cts +25 -0
- package/pg-core/unique-constraint.d.mts +25 -0
- package/pg-core/unique-constraint.d.ts +3 -3
- package/pg-core/utils.d.cts +52 -0
- package/pg-core/utils.d.mts +52 -0
- package/pg-core/utils.d.ts +16 -16
- package/pg-core/view.d.cts +143 -0
- package/pg-core/view.d.mts +143 -0
- package/pg-core/view.d.ts +13 -13
- package/planetscale-serverless/driver.d.cts +10 -0
- package/planetscale-serverless/driver.d.mts +10 -0
- package/planetscale-serverless/driver.d.ts +4 -4
- package/planetscale-serverless/index.cjs +18 -18
- package/planetscale-serverless/index.cjs.map +1 -1
- package/planetscale-serverless/index.d.cts +2 -0
- package/planetscale-serverless/index.d.mts +2 -0
- package/planetscale-serverless/index.d.ts +2 -2
- package/planetscale-serverless/index.mjs +3 -2
- package/planetscale-serverless/index.mjs.map +1 -1
- package/planetscale-serverless/migrator.d.cts +3 -0
- package/planetscale-serverless/migrator.d.mts +3 -0
- package/planetscale-serverless/migrator.d.ts +2 -2
- package/planetscale-serverless/session.d.cts +52 -0
- package/planetscale-serverless/session.d.mts +52 -0
- package/planetscale-serverless/session.d.ts +8 -8
- package/postgres-js/driver.d.cts +6 -0
- package/postgres-js/driver.d.mts +6 -0
- package/postgres-js/driver.d.ts +3 -3
- package/postgres-js/index.cjs +20 -20
- package/postgres-js/index.d.cts +2 -0
- package/postgres-js/index.d.mts +2 -0
- package/postgres-js/index.d.ts +2 -2
- package/postgres-js/index.mjs +3 -2
- package/postgres-js/index.mjs.map +1 -1
- package/postgres-js/migrator.d.cts +3 -0
- package/postgres-js/migrator.d.mts +3 -0
- package/postgres-js/migrator.d.ts +2 -2
- package/postgres-js/session.d.cts +49 -0
- package/postgres-js/session.d.mts +49 -0
- package/postgres-js/session.d.ts +10 -10
- package/primary-key.d.cts +10 -0
- package/primary-key.d.mts +10 -0
- package/primary-key.d.ts +3 -3
- package/query-builders/query-builder.d.cts +10 -0
- package/query-builders/query-builder.d.mts +10 -0
- package/query-builders/query-builder.d.ts +2 -2
- package/query-builders/select.types.d.cts +56 -0
- package/query-builders/select.types.d.mts +56 -0
- package/query-builders/select.types.d.ts +8 -8
- package/query-promise.d.cts +9 -0
- package/query-promise.d.mts +9 -0
- package/query-promise.d.ts +1 -1
- package/relations.d.cts +189 -0
- package/relations.d.mts +189 -0
- package/relations.d.ts +10 -10
- package/{session-775da517.mjs → session-a0c900ab.mjs} +5 -3
- package/session-a0c900ab.mjs.map +1 -0
- package/{session-e7fcd577.mjs → session-a706e83f.mjs} +3 -2
- package/session-a706e83f.mjs.map +1 -0
- package/{session-f61b6e4d.cjs → session-fadbb086.cjs} +239 -239
- package/session-fadbb086.cjs.map +1 -0
- package/sql/expressions/conditions.d.cts +393 -0
- package/sql/expressions/conditions.d.mts +393 -0
- package/sql/expressions/conditions.d.ts +2 -2
- package/sql/expressions/index.d.cts +2 -0
- package/sql/expressions/index.d.mts +2 -0
- package/sql/expressions/index.d.ts +2 -2
- package/sql/expressions/select.d.cts +38 -0
- package/sql/expressions/select.d.mts +38 -0
- package/sql/expressions/select.d.ts +2 -2
- package/sql/index.d.cts +191 -0
- package/sql/index.d.mts +191 -0
- package/sql/index.d.ts +7 -7
- package/sql-js/driver.d.cts +5 -0
- package/sql-js/driver.d.mts +5 -0
- package/sql-js/driver.d.ts +2 -2
- package/sql-js/index.cjs +19 -19
- package/sql-js/index.d.cts +2 -0
- package/sql-js/index.d.mts +2 -0
- package/sql-js/index.d.ts +2 -2
- package/sql-js/index.mjs +3 -2
- package/sql-js/index.mjs.map +1 -1
- package/sql-js/migrator.d.cts +3 -0
- package/sql-js/migrator.d.mts +3 -0
- package/sql-js/migrator.d.ts +2 -2
- package/sql-js/session.d.cts +52 -0
- package/sql-js/session.d.mts +52 -0
- package/sql-js/session.d.ts +9 -9
- package/sqlite-core/alias.d.cts +4 -0
- package/sqlite-core/alias.d.mts +4 -0
- package/sqlite-core/alias.d.ts +3 -3
- package/sqlite-core/checks.d.cts +22 -0
- package/sqlite-core/checks.d.mts +22 -0
- package/sqlite-core/checks.d.ts +3 -3
- package/sqlite-core/columns/blob.d.cts +65 -0
- package/sqlite-core/columns/blob.d.mts +65 -0
- package/sqlite-core/columns/blob.d.ts +6 -6
- package/sqlite-core/columns/common.d.cts +35 -0
- package/sqlite-core/columns/common.d.mts +35 -0
- package/sqlite-core/columns/common.d.ts +14 -12
- package/sqlite-core/columns/custom.d.cts +148 -0
- package/sqlite-core/columns/custom.d.mts +148 -0
- package/sqlite-core/columns/custom.d.ts +7 -7
- package/sqlite-core/columns/index.d.cts +7 -0
- package/sqlite-core/columns/index.d.mts +7 -0
- package/sqlite-core/columns/index.d.ts +7 -7
- package/sqlite-core/columns/integer.d.cts +106 -0
- package/sqlite-core/columns/integer.d.mts +106 -0
- package/sqlite-core/columns/integer.d.ts +7 -7
- package/sqlite-core/columns/numeric.d.cts +21 -0
- package/sqlite-core/columns/numeric.d.mts +21 -0
- package/sqlite-core/columns/numeric.d.ts +4 -4
- package/sqlite-core/columns/real.d.cts +21 -0
- package/sqlite-core/columns/real.d.mts +21 -0
- package/sqlite-core/columns/real.d.ts +4 -4
- package/sqlite-core/columns/text.d.cts +38 -0
- package/sqlite-core/columns/text.d.mts +38 -0
- package/sqlite-core/columns/text.d.ts +6 -6
- package/sqlite-core/db.d.cts +57 -0
- package/sqlite-core/db.d.mts +57 -0
- package/sqlite-core/db.d.ts +14 -14
- package/sqlite-core/dialect.d.cts +53 -0
- package/sqlite-core/dialect.d.mts +53 -0
- package/sqlite-core/dialect.d.ts +10 -10
- package/sqlite-core/expressions.d.cts +9 -0
- package/sqlite-core/expressions.d.mts +9 -0
- package/sqlite-core/expressions.d.ts +3 -3
- package/sqlite-core/foreign-keys.d.cts +48 -0
- package/sqlite-core/foreign-keys.d.mts +48 -0
- package/sqlite-core/foreign-keys.d.ts +3 -3
- package/sqlite-core/index.cjs +11 -11
- package/sqlite-core/index.cjs.map +1 -1
- package/sqlite-core/index.d.cts +15 -0
- package/sqlite-core/index.d.mts +15 -0
- package/sqlite-core/index.d.ts +15 -15
- package/sqlite-core/index.mjs +4 -3
- package/sqlite-core/index.mjs.map +1 -1
- package/sqlite-core/indexes.d.cts +41 -0
- package/sqlite-core/indexes.d.mts +41 -0
- package/sqlite-core/indexes.d.ts +4 -4
- package/sqlite-core/primary-keys.d.cts +20 -0
- package/sqlite-core/primary-keys.d.mts +20 -0
- package/sqlite-core/primary-keys.d.ts +3 -3
- package/sqlite-core/query-builders/delete.d.cts +42 -0
- package/sqlite-core/query-builders/delete.d.mts +42 -0
- package/sqlite-core/query-builders/delete.d.ts +10 -10
- package/sqlite-core/query-builders/index.d.cts +6 -0
- package/sqlite-core/query-builders/index.d.mts +6 -0
- package/sqlite-core/query-builders/index.d.ts +6 -6
- package/sqlite-core/query-builders/insert.d.cts +74 -0
- package/sqlite-core/query-builders/insert.d.mts +74 -0
- package/sqlite-core/query-builders/insert.d.ts +13 -13
- package/sqlite-core/query-builders/query-builder.d.cts +29 -0
- package/sqlite-core/query-builders/query-builder.d.mts +29 -0
- package/sqlite-core/query-builders/query-builder.d.ts +7 -7
- package/sqlite-core/query-builders/query.d.cts +47 -0
- package/sqlite-core/query-builders/query.d.mts +47 -0
- package/sqlite-core/query-builders/query.d.ts +7 -7
- package/sqlite-core/query-builders/select.d.cts +94 -0
- package/sqlite-core/query-builders/select.d.mts +94 -0
- package/sqlite-core/query-builders/select.d.ts +15 -15
- package/sqlite-core/query-builders/select.types.d.cts +63 -0
- package/sqlite-core/query-builders/select.types.d.mts +63 -0
- package/sqlite-core/query-builders/select.types.d.ts +11 -11
- package/sqlite-core/query-builders/update.d.cts +63 -0
- package/sqlite-core/query-builders/update.d.mts +63 -0
- package/sqlite-core/query-builders/update.d.ts +11 -11
- package/sqlite-core/session.d.cts +91 -0
- package/sqlite-core/session.d.mts +91 -0
- package/sqlite-core/session.d.ts +7 -7
- package/sqlite-core/subquery.d.cts +5 -0
- package/sqlite-core/subquery.d.mts +5 -0
- package/sqlite-core/subquery.d.ts +3 -3
- package/sqlite-core/table.d.cts +28 -0
- package/sqlite-core/table.d.mts +28 -0
- package/sqlite-core/table.d.ts +10 -10
- package/sqlite-core/unique-constraint.d.cts +23 -0
- package/sqlite-core/unique-constraint.d.mts +23 -0
- package/sqlite-core/unique-constraint.d.ts +3 -3
- package/sqlite-core/utils.d.cts +31 -0
- package/sqlite-core/utils.d.mts +31 -0
- package/sqlite-core/utils.d.ts +11 -11
- package/sqlite-core/view.d.cts +67 -0
- package/sqlite-core/view.d.mts +67 -0
- package/sqlite-core/view.d.ts +11 -11
- package/sqlite-proxy/driver.d.cts +11 -0
- package/sqlite-proxy/driver.d.mts +11 -0
- package/sqlite-proxy/driver.d.ts +2 -2
- package/sqlite-proxy/index.cjs +19 -19
- package/sqlite-proxy/index.d.cts +2 -0
- package/sqlite-proxy/index.d.mts +2 -0
- package/sqlite-proxy/index.d.ts +2 -2
- package/sqlite-proxy/index.mjs +3 -2
- package/sqlite-proxy/index.mjs.map +1 -1
- package/sqlite-proxy/migrator.cjs +4 -3
- package/sqlite-proxy/migrator.cjs.map +1 -1
- package/sqlite-proxy/migrator.d.cts +4 -0
- package/sqlite-proxy/migrator.d.mts +4 -0
- package/sqlite-proxy/migrator.d.ts +2 -2
- package/sqlite-proxy/migrator.mjs +2 -1
- package/sqlite-proxy/migrator.mjs.map +1 -1
- package/sqlite-proxy/session.d.cts +48 -0
- package/sqlite-proxy/session.d.mts +48 -0
- package/sqlite-proxy/session.d.ts +10 -10
- package/subquery.d.cts +23 -0
- package/subquery.d.mts +23 -0
- package/subquery.d.ts +3 -3
- package/table.d.cts +63 -0
- package/table.d.mts +63 -0
- package/table.d.ts +8 -8
- package/tracing.d.cts +1 -0
- package/tracing.d.mts +1 -0
- package/utils.d.cts +45 -0
- package/utils.d.mts +45 -0
- package/utils.d.ts +4 -4
- package/vercel-postgres/driver.d.cts +21 -0
- package/vercel-postgres/driver.d.mts +21 -0
- package/vercel-postgres/driver.d.ts +7 -7
- package/vercel-postgres/index.cjs +22 -22
- package/vercel-postgres/index.d.cts +2 -0
- package/vercel-postgres/index.d.mts +2 -0
- package/vercel-postgres/index.d.ts +2 -2
- package/vercel-postgres/index.mjs +3 -2
- package/vercel-postgres/index.mjs.map +1 -1
- package/vercel-postgres/migrator.d.cts +3 -0
- package/vercel-postgres/migrator.d.mts +3 -0
- package/vercel-postgres/migrator.d.ts +2 -2
- package/vercel-postgres/session.d.cts +47 -0
- package/vercel-postgres/session.d.mts +47 -0
- package/vercel-postgres/session.d.ts +9 -9
- package/version.cjs +1 -1
- package/version.d.cts +2 -0
- package/version.d.mts +2 -0
- package/version.mjs +1 -1
- package/{session-9eb850c1.mjs → view-ba779eb7.mjs} +171 -169
- package/view-ba779eb7.mjs.map +1 -0
- package/{session-690cd067.cjs → view-e96fe3b6.cjs} +1400 -445
- package/view-e96fe3b6.cjs.map +1 -0
- package/view.d.cts +24 -0
- package/view.d.mts +24 -0
- package/view.d.ts +5 -5
- package/alias-58b7b8c9.cjs.map +0 -1
- package/alias-d302772a.mjs.map +0 -1
- package/session-690cd067.cjs.map +0 -1
- package/session-775da517.mjs.map +0 -1
- package/session-9eb850c1.mjs.map +0 -1
- package/session-e7fcd577.mjs.map +0 -1
- package/session-f61b6e4d.cjs.map +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { entityKind } from '../../entity.js';
|
|
2
|
+
import type { PgDialect } from '../dialect.js';
|
|
3
|
+
import type { PgSession, PreparedQuery, PreparedQueryConfig, QueryResultHKT, QueryResultKind } from '../session.js';
|
|
4
|
+
import type { PgMaterializedView } from '../view.js';
|
|
5
|
+
import { QueryPromise } from '../../query-promise.js';
|
|
6
|
+
import type { Query } from '../../sql/index.js';
|
|
7
|
+
export interface PgRefreshMaterializedView<TQueryResult extends QueryResultHKT> extends QueryPromise<QueryResultKind<TQueryResult, never>> {
|
|
8
|
+
}
|
|
9
|
+
export declare class PgRefreshMaterializedView<TQueryResult extends QueryResultHKT> extends QueryPromise<QueryResultKind<TQueryResult, never>> {
|
|
10
|
+
private session;
|
|
11
|
+
private dialect;
|
|
12
|
+
static readonly [entityKind]: string;
|
|
13
|
+
private config;
|
|
14
|
+
constructor(view: PgMaterializedView, session: PgSession, dialect: PgDialect);
|
|
15
|
+
concurrently(): this;
|
|
16
|
+
withNoData(): this;
|
|
17
|
+
toSQL(): {
|
|
18
|
+
sql: Query['sql'];
|
|
19
|
+
params: Query['params'];
|
|
20
|
+
};
|
|
21
|
+
private _prepare;
|
|
22
|
+
prepare(name: string): PreparedQuery<PreparedQueryConfig & {
|
|
23
|
+
execute: QueryResultKind<TQueryResult, never>;
|
|
24
|
+
}>;
|
|
25
|
+
execute: ReturnType<this['prepare']>['execute'];
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { entityKind } from '../../entity.js';
|
|
2
|
+
import type { PgDialect } from '../dialect.js';
|
|
3
|
+
import type { PgSession, PreparedQuery, PreparedQueryConfig, QueryResultHKT, QueryResultKind } from '../session.js';
|
|
4
|
+
import type { PgMaterializedView } from '../view.js';
|
|
5
|
+
import { QueryPromise } from '../../query-promise.js';
|
|
6
|
+
import type { Query } from '../../sql/index.js';
|
|
7
|
+
export interface PgRefreshMaterializedView<TQueryResult extends QueryResultHKT> extends QueryPromise<QueryResultKind<TQueryResult, never>> {
|
|
8
|
+
}
|
|
9
|
+
export declare class PgRefreshMaterializedView<TQueryResult extends QueryResultHKT> extends QueryPromise<QueryResultKind<TQueryResult, never>> {
|
|
10
|
+
private session;
|
|
11
|
+
private dialect;
|
|
12
|
+
static readonly [entityKind]: string;
|
|
13
|
+
private config;
|
|
14
|
+
constructor(view: PgMaterializedView, session: PgSession, dialect: PgDialect);
|
|
15
|
+
concurrently(): this;
|
|
16
|
+
withNoData(): this;
|
|
17
|
+
toSQL(): {
|
|
18
|
+
sql: Query['sql'];
|
|
19
|
+
params: Query['params'];
|
|
20
|
+
};
|
|
21
|
+
private _prepare;
|
|
22
|
+
prepare(name: string): PreparedQuery<PreparedQueryConfig & {
|
|
23
|
+
execute: QueryResultKind<TQueryResult, never>;
|
|
24
|
+
}>;
|
|
25
|
+
execute: ReturnType<this['prepare']>['execute'];
|
|
26
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { entityKind } from '../../entity';
|
|
2
|
-
import type { PgDialect } from '../dialect';
|
|
3
|
-
import type { PgSession, PreparedQuery, PreparedQueryConfig, QueryResultHKT, QueryResultKind } from '../session';
|
|
4
|
-
import type { PgMaterializedView } from '../view';
|
|
5
|
-
import { QueryPromise } from '../../query-promise';
|
|
6
|
-
import type { Query } from '../../sql';
|
|
1
|
+
import { entityKind } from '../../entity.js';
|
|
2
|
+
import type { PgDialect } from '../dialect.js';
|
|
3
|
+
import type { PgSession, PreparedQuery, PreparedQueryConfig, QueryResultHKT, QueryResultKind } from '../session.js';
|
|
4
|
+
import type { PgMaterializedView } from '../view.js';
|
|
5
|
+
import { QueryPromise } from '../../query-promise.js';
|
|
6
|
+
import type { Query } from '../../sql/index.js';
|
|
7
7
|
export interface PgRefreshMaterializedView<TQueryResult extends QueryResultHKT> extends QueryPromise<QueryResultKind<TQueryResult, never>> {
|
|
8
8
|
}
|
|
9
9
|
export declare class PgRefreshMaterializedView<TQueryResult extends QueryResultHKT> extends QueryPromise<QueryResultKind<TQueryResult, never>> {
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { entityKind } from '../../entity.js';
|
|
2
|
+
import type { PgColumn } from '../columns/index.js';
|
|
3
|
+
import type { PgDialect } from '../dialect.js';
|
|
4
|
+
import type { PgSession, PreparedQuery, PreparedQueryConfig } from '../session.js';
|
|
5
|
+
import type { SubqueryWithSelection } from '../subquery.js';
|
|
6
|
+
import type { PgTable } from '../table.js';
|
|
7
|
+
import { PgViewBase } from '../view.js';
|
|
8
|
+
import { TypedQueryBuilder } from '../../query-builders/query-builder.js';
|
|
9
|
+
import type { BuildSubquerySelection, GetSelectTableName, GetSelectTableSelection, JoinNullability, SelectMode, SelectResult } from '../../query-builders/select.types.js';
|
|
10
|
+
import { QueryPromise } from '../../query-promise.js';
|
|
11
|
+
import { type Placeholder, type Query, SQL, type SQLWrapper } from '../../sql/index.js';
|
|
12
|
+
import { Subquery } from '../../subquery.js';
|
|
13
|
+
import { type ValueOrArray } from '../../utils.js';
|
|
14
|
+
import { type ColumnsSelection } from '../../view.js';
|
|
15
|
+
import type { JoinFn, LockConfig, LockStrength, PgSelectConfig, PgSelectHKT, PgSelectHKTBase, PgSelectQueryBuilderHKT, SelectedFields } from './select.types.js';
|
|
16
|
+
type CreatePgSelectFromBuilderMode<TBuilderMode extends 'db' | 'qb', TTableName extends string | undefined, TSelection extends ColumnsSelection, TSelectMode extends SelectMode> = TBuilderMode extends 'db' ? PgSelect<TTableName, TSelection, TSelectMode> : PgSelectQueryBuilder<PgSelectQueryBuilderHKT, TTableName, TSelection, TSelectMode>;
|
|
17
|
+
export declare class PgSelectBuilder<TSelection extends SelectedFields | undefined, TBuilderMode extends 'db' | 'qb' = 'db'> {
|
|
18
|
+
static readonly [entityKind]: string;
|
|
19
|
+
private fields;
|
|
20
|
+
private session;
|
|
21
|
+
private dialect;
|
|
22
|
+
private withList;
|
|
23
|
+
private distinct;
|
|
24
|
+
constructor(config: {
|
|
25
|
+
fields: TSelection;
|
|
26
|
+
session: PgSession | undefined;
|
|
27
|
+
dialect: PgDialect;
|
|
28
|
+
withList?: Subquery[];
|
|
29
|
+
distinct?: boolean | {
|
|
30
|
+
on: (PgColumn | SQLWrapper)[];
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Specify the table, subquery, or other target that you're
|
|
35
|
+
* building a select query against.
|
|
36
|
+
*
|
|
37
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM|Postgres from documentation}
|
|
38
|
+
*/
|
|
39
|
+
from<TFrom extends PgTable | Subquery | PgViewBase | SQL>(source: TFrom): CreatePgSelectFromBuilderMode<TBuilderMode, GetSelectTableName<TFrom>, TSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection, TSelection extends undefined ? 'single' : 'partial'>;
|
|
40
|
+
}
|
|
41
|
+
export declare abstract class PgSelectQueryBuilder<THKT extends PgSelectHKTBase, TTableName extends string | undefined, TSelection extends ColumnsSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends TypedQueryBuilder<BuildSubquerySelection<TSelection, TNullabilityMap>, SelectResult<TSelection, TSelectMode, TNullabilityMap>[]> {
|
|
42
|
+
static readonly [entityKind]: string;
|
|
43
|
+
readonly _: {
|
|
44
|
+
readonly selectMode: TSelectMode;
|
|
45
|
+
readonly selection: TSelection;
|
|
46
|
+
readonly result: SelectResult<TSelection, TSelectMode, TNullabilityMap>[];
|
|
47
|
+
readonly selectedFields: BuildSubquerySelection<TSelection, TNullabilityMap>;
|
|
48
|
+
};
|
|
49
|
+
protected config: PgSelectConfig;
|
|
50
|
+
protected joinsNotNullableMap: Record<string, boolean>;
|
|
51
|
+
private tableName;
|
|
52
|
+
private isPartialSelect;
|
|
53
|
+
protected session: PgSession | undefined;
|
|
54
|
+
protected dialect: PgDialect;
|
|
55
|
+
constructor({ table, fields, isPartialSelect, session, dialect, withList, distinct }: {
|
|
56
|
+
table: PgSelectConfig['table'];
|
|
57
|
+
fields: PgSelectConfig['fields'];
|
|
58
|
+
isPartialSelect: boolean;
|
|
59
|
+
session: PgSession | undefined;
|
|
60
|
+
dialect: PgDialect;
|
|
61
|
+
withList: Subquery[];
|
|
62
|
+
distinct: boolean | {
|
|
63
|
+
on: (PgColumn | SQLWrapper)[];
|
|
64
|
+
} | undefined;
|
|
65
|
+
});
|
|
66
|
+
private createJoin;
|
|
67
|
+
/**
|
|
68
|
+
* For each row of the table, include
|
|
69
|
+
* values from a matching row of the joined
|
|
70
|
+
* table, if there is a matching row. If not,
|
|
71
|
+
* all of the columns of the joined table
|
|
72
|
+
* will be set to null.
|
|
73
|
+
*/
|
|
74
|
+
leftJoin: JoinFn<THKT, TTableName, TSelectMode, "left", TSelection, TNullabilityMap>;
|
|
75
|
+
/**
|
|
76
|
+
* Includes all of the rows of the joined table.
|
|
77
|
+
* If there is no matching row in the main table,
|
|
78
|
+
* all the columns of the main table will be
|
|
79
|
+
* set to null.
|
|
80
|
+
*/
|
|
81
|
+
rightJoin: JoinFn<THKT, TTableName, TSelectMode, "right", TSelection, TNullabilityMap>;
|
|
82
|
+
/**
|
|
83
|
+
* This is the default type of join.
|
|
84
|
+
*
|
|
85
|
+
* For each row of the table, the joined table
|
|
86
|
+
* needs to have a matching row, or it will
|
|
87
|
+
* be excluded from results.
|
|
88
|
+
*/
|
|
89
|
+
innerJoin: JoinFn<THKT, TTableName, TSelectMode, "inner", TSelection, TNullabilityMap>;
|
|
90
|
+
/**
|
|
91
|
+
* Rows from both the main & joined are included,
|
|
92
|
+
* regardless of whether or not they have matching
|
|
93
|
+
* rows in the other table.
|
|
94
|
+
*/
|
|
95
|
+
fullJoin: JoinFn<THKT, TTableName, TSelectMode, "full", TSelection, TNullabilityMap>;
|
|
96
|
+
/**
|
|
97
|
+
* Specify a condition to narrow the result set. Multiple
|
|
98
|
+
* conditions can be combined with the `and` and `or`
|
|
99
|
+
* functions.
|
|
100
|
+
*
|
|
101
|
+
* ## Examples
|
|
102
|
+
*
|
|
103
|
+
* ```ts
|
|
104
|
+
* // Find cars made in the year 2000
|
|
105
|
+
* db.select().from(cars).where(eq(cars.year, 2000));
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
where(where: ((aliases: TSelection) => SQL | undefined) | SQL | undefined): this;
|
|
109
|
+
/**
|
|
110
|
+
* Sets the HAVING clause of this query, which often
|
|
111
|
+
* used with GROUP BY and filters rows after they've been
|
|
112
|
+
* grouped together and combined.
|
|
113
|
+
*
|
|
114
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-HAVING|Postgres having clause documentation}
|
|
115
|
+
*/
|
|
116
|
+
having(having: ((aliases: TSelection) => SQL | undefined) | SQL | undefined): this;
|
|
117
|
+
/**
|
|
118
|
+
* Specify the GROUP BY of this query: given
|
|
119
|
+
* a list of columns or SQL expressions, Postgres will
|
|
120
|
+
* combine all rows with the same values in those columns
|
|
121
|
+
* into a single row.
|
|
122
|
+
*
|
|
123
|
+
* ## Examples
|
|
124
|
+
*
|
|
125
|
+
* ```ts
|
|
126
|
+
* // Group and count people by their last names
|
|
127
|
+
* db.select({
|
|
128
|
+
* lastName: people.lastName,
|
|
129
|
+
* count: sql<number>`count(*)::integer`
|
|
130
|
+
* }).from(people).groupBy(people.lastName);
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-GROUPBY|Postgres GROUP BY documentation}
|
|
134
|
+
*/
|
|
135
|
+
groupBy(builder: (aliases: TSelection) => ValueOrArray<PgColumn | SQL | SQL.Aliased>): this;
|
|
136
|
+
groupBy(...columns: (PgColumn | SQL | SQL.Aliased)[]): this;
|
|
137
|
+
/**
|
|
138
|
+
* Specify the ORDER BY clause of this query: a number of
|
|
139
|
+
* columns or SQL expressions that will control sorting
|
|
140
|
+
* of results. You can specify whether results are in ascending
|
|
141
|
+
* or descending order with the `asc()` and `desc()` operators.
|
|
142
|
+
*
|
|
143
|
+
* ## Examples
|
|
144
|
+
*
|
|
145
|
+
* ```
|
|
146
|
+
* // Select cars by year released
|
|
147
|
+
* db.select().from(cars).orderBy(cars.year);
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-ORDERBY|Postgres ORDER BY documentation}
|
|
151
|
+
*/
|
|
152
|
+
orderBy(builder: (aliases: TSelection) => ValueOrArray<PgColumn | SQL | SQL.Aliased>): this;
|
|
153
|
+
orderBy(...columns: (PgColumn | SQL | SQL.Aliased)[]): this;
|
|
154
|
+
/**
|
|
155
|
+
* Set the maximum number of rows that will be
|
|
156
|
+
* returned by this query.
|
|
157
|
+
*
|
|
158
|
+
* ## Examples
|
|
159
|
+
*
|
|
160
|
+
* ```ts
|
|
161
|
+
* // Get the first 10 people from this query.
|
|
162
|
+
* db.select().from(people).limit(10);
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-LIMIT|Postgres LIMIT documentation}
|
|
166
|
+
*/
|
|
167
|
+
limit(limit: number | Placeholder): this;
|
|
168
|
+
/**
|
|
169
|
+
* Skip a number of rows when returning results
|
|
170
|
+
* from this query.
|
|
171
|
+
*
|
|
172
|
+
* ## Examples
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* // Get the 10th-20th people from this query.
|
|
176
|
+
* db.select().from(people).offset(10).limit(10);
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
offset(offset: number | Placeholder): this;
|
|
180
|
+
/**
|
|
181
|
+
* The FOR clause specifies a lock strength for this query
|
|
182
|
+
* that controls how strictly it acquires exclusive access to
|
|
183
|
+
* the rows being queried.
|
|
184
|
+
*
|
|
185
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE|Postgres locking clause documentation}
|
|
186
|
+
*/
|
|
187
|
+
for(strength: LockStrength, config?: LockConfig): this;
|
|
188
|
+
toSQL(): {
|
|
189
|
+
sql: Query['sql'];
|
|
190
|
+
params: Query['params'];
|
|
191
|
+
};
|
|
192
|
+
as<TAlias extends string>(alias: TAlias): SubqueryWithSelection<BuildSubquerySelection<TSelection, TNullabilityMap>, TAlias>;
|
|
193
|
+
}
|
|
194
|
+
export interface PgSelect<TTableName extends string | undefined, TSelection extends ColumnsSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap>, QueryPromise<SelectResult<TSelection, TSelectMode, TNullabilityMap>[]> {
|
|
195
|
+
}
|
|
196
|
+
export declare class PgSelect<TTableName extends string | undefined, TSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap> {
|
|
197
|
+
static readonly [entityKind]: string;
|
|
198
|
+
private _prepare;
|
|
199
|
+
/**
|
|
200
|
+
* Create a prepared statement for this query. This allows
|
|
201
|
+
* the database to remember this query for the given session
|
|
202
|
+
* and call it by name, rather than specifying the full query.
|
|
203
|
+
*
|
|
204
|
+
* {@link https://www.postgresql.org/docs/current/sql-prepare.html|Postgres prepare documentation}
|
|
205
|
+
*/
|
|
206
|
+
prepare(name: string): PreparedQuery<PreparedQueryConfig & {
|
|
207
|
+
execute: SelectResult<TSelection, TSelectMode, TNullabilityMap>[];
|
|
208
|
+
}>;
|
|
209
|
+
execute: ReturnType<this['prepare']>['execute'];
|
|
210
|
+
}
|
|
211
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { entityKind } from '../../entity.js';
|
|
2
|
+
import type { PgColumn } from '../columns/index.js';
|
|
3
|
+
import type { PgDialect } from '../dialect.js';
|
|
4
|
+
import type { PgSession, PreparedQuery, PreparedQueryConfig } from '../session.js';
|
|
5
|
+
import type { SubqueryWithSelection } from '../subquery.js';
|
|
6
|
+
import type { PgTable } from '../table.js';
|
|
7
|
+
import { PgViewBase } from '../view.js';
|
|
8
|
+
import { TypedQueryBuilder } from '../../query-builders/query-builder.js';
|
|
9
|
+
import type { BuildSubquerySelection, GetSelectTableName, GetSelectTableSelection, JoinNullability, SelectMode, SelectResult } from '../../query-builders/select.types.js';
|
|
10
|
+
import { QueryPromise } from '../../query-promise.js';
|
|
11
|
+
import { type Placeholder, type Query, SQL, type SQLWrapper } from '../../sql/index.js';
|
|
12
|
+
import { Subquery } from '../../subquery.js';
|
|
13
|
+
import { type ValueOrArray } from '../../utils.js';
|
|
14
|
+
import { type ColumnsSelection } from '../../view.js';
|
|
15
|
+
import type { JoinFn, LockConfig, LockStrength, PgSelectConfig, PgSelectHKT, PgSelectHKTBase, PgSelectQueryBuilderHKT, SelectedFields } from './select.types.js';
|
|
16
|
+
type CreatePgSelectFromBuilderMode<TBuilderMode extends 'db' | 'qb', TTableName extends string | undefined, TSelection extends ColumnsSelection, TSelectMode extends SelectMode> = TBuilderMode extends 'db' ? PgSelect<TTableName, TSelection, TSelectMode> : PgSelectQueryBuilder<PgSelectQueryBuilderHKT, TTableName, TSelection, TSelectMode>;
|
|
17
|
+
export declare class PgSelectBuilder<TSelection extends SelectedFields | undefined, TBuilderMode extends 'db' | 'qb' = 'db'> {
|
|
18
|
+
static readonly [entityKind]: string;
|
|
19
|
+
private fields;
|
|
20
|
+
private session;
|
|
21
|
+
private dialect;
|
|
22
|
+
private withList;
|
|
23
|
+
private distinct;
|
|
24
|
+
constructor(config: {
|
|
25
|
+
fields: TSelection;
|
|
26
|
+
session: PgSession | undefined;
|
|
27
|
+
dialect: PgDialect;
|
|
28
|
+
withList?: Subquery[];
|
|
29
|
+
distinct?: boolean | {
|
|
30
|
+
on: (PgColumn | SQLWrapper)[];
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Specify the table, subquery, or other target that you're
|
|
35
|
+
* building a select query against.
|
|
36
|
+
*
|
|
37
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM|Postgres from documentation}
|
|
38
|
+
*/
|
|
39
|
+
from<TFrom extends PgTable | Subquery | PgViewBase | SQL>(source: TFrom): CreatePgSelectFromBuilderMode<TBuilderMode, GetSelectTableName<TFrom>, TSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection, TSelection extends undefined ? 'single' : 'partial'>;
|
|
40
|
+
}
|
|
41
|
+
export declare abstract class PgSelectQueryBuilder<THKT extends PgSelectHKTBase, TTableName extends string | undefined, TSelection extends ColumnsSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends TypedQueryBuilder<BuildSubquerySelection<TSelection, TNullabilityMap>, SelectResult<TSelection, TSelectMode, TNullabilityMap>[]> {
|
|
42
|
+
static readonly [entityKind]: string;
|
|
43
|
+
readonly _: {
|
|
44
|
+
readonly selectMode: TSelectMode;
|
|
45
|
+
readonly selection: TSelection;
|
|
46
|
+
readonly result: SelectResult<TSelection, TSelectMode, TNullabilityMap>[];
|
|
47
|
+
readonly selectedFields: BuildSubquerySelection<TSelection, TNullabilityMap>;
|
|
48
|
+
};
|
|
49
|
+
protected config: PgSelectConfig;
|
|
50
|
+
protected joinsNotNullableMap: Record<string, boolean>;
|
|
51
|
+
private tableName;
|
|
52
|
+
private isPartialSelect;
|
|
53
|
+
protected session: PgSession | undefined;
|
|
54
|
+
protected dialect: PgDialect;
|
|
55
|
+
constructor({ table, fields, isPartialSelect, session, dialect, withList, distinct }: {
|
|
56
|
+
table: PgSelectConfig['table'];
|
|
57
|
+
fields: PgSelectConfig['fields'];
|
|
58
|
+
isPartialSelect: boolean;
|
|
59
|
+
session: PgSession | undefined;
|
|
60
|
+
dialect: PgDialect;
|
|
61
|
+
withList: Subquery[];
|
|
62
|
+
distinct: boolean | {
|
|
63
|
+
on: (PgColumn | SQLWrapper)[];
|
|
64
|
+
} | undefined;
|
|
65
|
+
});
|
|
66
|
+
private createJoin;
|
|
67
|
+
/**
|
|
68
|
+
* For each row of the table, include
|
|
69
|
+
* values from a matching row of the joined
|
|
70
|
+
* table, if there is a matching row. If not,
|
|
71
|
+
* all of the columns of the joined table
|
|
72
|
+
* will be set to null.
|
|
73
|
+
*/
|
|
74
|
+
leftJoin: JoinFn<THKT, TTableName, TSelectMode, "left", TSelection, TNullabilityMap>;
|
|
75
|
+
/**
|
|
76
|
+
* Includes all of the rows of the joined table.
|
|
77
|
+
* If there is no matching row in the main table,
|
|
78
|
+
* all the columns of the main table will be
|
|
79
|
+
* set to null.
|
|
80
|
+
*/
|
|
81
|
+
rightJoin: JoinFn<THKT, TTableName, TSelectMode, "right", TSelection, TNullabilityMap>;
|
|
82
|
+
/**
|
|
83
|
+
* This is the default type of join.
|
|
84
|
+
*
|
|
85
|
+
* For each row of the table, the joined table
|
|
86
|
+
* needs to have a matching row, or it will
|
|
87
|
+
* be excluded from results.
|
|
88
|
+
*/
|
|
89
|
+
innerJoin: JoinFn<THKT, TTableName, TSelectMode, "inner", TSelection, TNullabilityMap>;
|
|
90
|
+
/**
|
|
91
|
+
* Rows from both the main & joined are included,
|
|
92
|
+
* regardless of whether or not they have matching
|
|
93
|
+
* rows in the other table.
|
|
94
|
+
*/
|
|
95
|
+
fullJoin: JoinFn<THKT, TTableName, TSelectMode, "full", TSelection, TNullabilityMap>;
|
|
96
|
+
/**
|
|
97
|
+
* Specify a condition to narrow the result set. Multiple
|
|
98
|
+
* conditions can be combined with the `and` and `or`
|
|
99
|
+
* functions.
|
|
100
|
+
*
|
|
101
|
+
* ## Examples
|
|
102
|
+
*
|
|
103
|
+
* ```ts
|
|
104
|
+
* // Find cars made in the year 2000
|
|
105
|
+
* db.select().from(cars).where(eq(cars.year, 2000));
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
where(where: ((aliases: TSelection) => SQL | undefined) | SQL | undefined): this;
|
|
109
|
+
/**
|
|
110
|
+
* Sets the HAVING clause of this query, which often
|
|
111
|
+
* used with GROUP BY and filters rows after they've been
|
|
112
|
+
* grouped together and combined.
|
|
113
|
+
*
|
|
114
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-HAVING|Postgres having clause documentation}
|
|
115
|
+
*/
|
|
116
|
+
having(having: ((aliases: TSelection) => SQL | undefined) | SQL | undefined): this;
|
|
117
|
+
/**
|
|
118
|
+
* Specify the GROUP BY of this query: given
|
|
119
|
+
* a list of columns or SQL expressions, Postgres will
|
|
120
|
+
* combine all rows with the same values in those columns
|
|
121
|
+
* into a single row.
|
|
122
|
+
*
|
|
123
|
+
* ## Examples
|
|
124
|
+
*
|
|
125
|
+
* ```ts
|
|
126
|
+
* // Group and count people by their last names
|
|
127
|
+
* db.select({
|
|
128
|
+
* lastName: people.lastName,
|
|
129
|
+
* count: sql<number>`count(*)::integer`
|
|
130
|
+
* }).from(people).groupBy(people.lastName);
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-GROUPBY|Postgres GROUP BY documentation}
|
|
134
|
+
*/
|
|
135
|
+
groupBy(builder: (aliases: TSelection) => ValueOrArray<PgColumn | SQL | SQL.Aliased>): this;
|
|
136
|
+
groupBy(...columns: (PgColumn | SQL | SQL.Aliased)[]): this;
|
|
137
|
+
/**
|
|
138
|
+
* Specify the ORDER BY clause of this query: a number of
|
|
139
|
+
* columns or SQL expressions that will control sorting
|
|
140
|
+
* of results. You can specify whether results are in ascending
|
|
141
|
+
* or descending order with the `asc()` and `desc()` operators.
|
|
142
|
+
*
|
|
143
|
+
* ## Examples
|
|
144
|
+
*
|
|
145
|
+
* ```
|
|
146
|
+
* // Select cars by year released
|
|
147
|
+
* db.select().from(cars).orderBy(cars.year);
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-ORDERBY|Postgres ORDER BY documentation}
|
|
151
|
+
*/
|
|
152
|
+
orderBy(builder: (aliases: TSelection) => ValueOrArray<PgColumn | SQL | SQL.Aliased>): this;
|
|
153
|
+
orderBy(...columns: (PgColumn | SQL | SQL.Aliased)[]): this;
|
|
154
|
+
/**
|
|
155
|
+
* Set the maximum number of rows that will be
|
|
156
|
+
* returned by this query.
|
|
157
|
+
*
|
|
158
|
+
* ## Examples
|
|
159
|
+
*
|
|
160
|
+
* ```ts
|
|
161
|
+
* // Get the first 10 people from this query.
|
|
162
|
+
* db.select().from(people).limit(10);
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-LIMIT|Postgres LIMIT documentation}
|
|
166
|
+
*/
|
|
167
|
+
limit(limit: number | Placeholder): this;
|
|
168
|
+
/**
|
|
169
|
+
* Skip a number of rows when returning results
|
|
170
|
+
* from this query.
|
|
171
|
+
*
|
|
172
|
+
* ## Examples
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* // Get the 10th-20th people from this query.
|
|
176
|
+
* db.select().from(people).offset(10).limit(10);
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
offset(offset: number | Placeholder): this;
|
|
180
|
+
/**
|
|
181
|
+
* The FOR clause specifies a lock strength for this query
|
|
182
|
+
* that controls how strictly it acquires exclusive access to
|
|
183
|
+
* the rows being queried.
|
|
184
|
+
*
|
|
185
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE|Postgres locking clause documentation}
|
|
186
|
+
*/
|
|
187
|
+
for(strength: LockStrength, config?: LockConfig): this;
|
|
188
|
+
toSQL(): {
|
|
189
|
+
sql: Query['sql'];
|
|
190
|
+
params: Query['params'];
|
|
191
|
+
};
|
|
192
|
+
as<TAlias extends string>(alias: TAlias): SubqueryWithSelection<BuildSubquerySelection<TSelection, TNullabilityMap>, TAlias>;
|
|
193
|
+
}
|
|
194
|
+
export interface PgSelect<TTableName extends string | undefined, TSelection extends ColumnsSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap>, QueryPromise<SelectResult<TSelection, TSelectMode, TNullabilityMap>[]> {
|
|
195
|
+
}
|
|
196
|
+
export declare class PgSelect<TTableName extends string | undefined, TSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap> {
|
|
197
|
+
static readonly [entityKind]: string;
|
|
198
|
+
private _prepare;
|
|
199
|
+
/**
|
|
200
|
+
* Create a prepared statement for this query. This allows
|
|
201
|
+
* the database to remember this query for the given session
|
|
202
|
+
* and call it by name, rather than specifying the full query.
|
|
203
|
+
*
|
|
204
|
+
* {@link https://www.postgresql.org/docs/current/sql-prepare.html|Postgres prepare documentation}
|
|
205
|
+
*/
|
|
206
|
+
prepare(name: string): PreparedQuery<PreparedQueryConfig & {
|
|
207
|
+
execute: SelectResult<TSelection, TSelectMode, TNullabilityMap>[];
|
|
208
|
+
}>;
|
|
209
|
+
execute: ReturnType<this['prepare']>['execute'];
|
|
210
|
+
}
|
|
211
|
+
export {};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { entityKind } from '../../entity';
|
|
2
|
-
import type { PgColumn } from '../columns';
|
|
3
|
-
import type { PgDialect } from '../dialect';
|
|
4
|
-
import type { PgSession, PreparedQuery, PreparedQueryConfig } from '../session';
|
|
5
|
-
import type { SubqueryWithSelection } from '../subquery';
|
|
6
|
-
import type { PgTable } from '../table';
|
|
7
|
-
import { PgViewBase } from '../view';
|
|
8
|
-
import { TypedQueryBuilder } from '../../query-builders/query-builder';
|
|
9
|
-
import type { BuildSubquerySelection, GetSelectTableName, GetSelectTableSelection, JoinNullability, SelectMode, SelectResult } from '../../query-builders/select.types';
|
|
10
|
-
import { QueryPromise } from '../../query-promise';
|
|
11
|
-
import { type Placeholder, type Query, SQL, type SQLWrapper } from '../../sql';
|
|
12
|
-
import { Subquery } from '../../subquery';
|
|
13
|
-
import { type ValueOrArray } from '../../utils';
|
|
14
|
-
import { type ColumnsSelection } from '../../view';
|
|
15
|
-
import type { JoinFn, LockConfig, LockStrength, PgSelectConfig, PgSelectHKT, PgSelectHKTBase, PgSelectQueryBuilderHKT, SelectedFields } from './select.types';
|
|
1
|
+
import { entityKind } from '../../entity.js';
|
|
2
|
+
import type { PgColumn } from '../columns/index.js';
|
|
3
|
+
import type { PgDialect } from '../dialect.js';
|
|
4
|
+
import type { PgSession, PreparedQuery, PreparedQueryConfig } from '../session.js';
|
|
5
|
+
import type { SubqueryWithSelection } from '../subquery.js';
|
|
6
|
+
import type { PgTable } from '../table.js';
|
|
7
|
+
import { PgViewBase } from '../view.js';
|
|
8
|
+
import { TypedQueryBuilder } from '../../query-builders/query-builder.js';
|
|
9
|
+
import type { BuildSubquerySelection, GetSelectTableName, GetSelectTableSelection, JoinNullability, SelectMode, SelectResult } from '../../query-builders/select.types.js';
|
|
10
|
+
import { QueryPromise } from '../../query-promise.js';
|
|
11
|
+
import { type Placeholder, type Query, SQL, type SQLWrapper } from '../../sql/index.js';
|
|
12
|
+
import { Subquery } from '../../subquery.js';
|
|
13
|
+
import { type ValueOrArray } from '../../utils.js';
|
|
14
|
+
import { type ColumnsSelection } from '../../view.js';
|
|
15
|
+
import type { JoinFn, LockConfig, LockStrength, PgSelectConfig, PgSelectHKT, PgSelectHKTBase, PgSelectQueryBuilderHKT, SelectedFields } from './select.types.js';
|
|
16
16
|
type CreatePgSelectFromBuilderMode<TBuilderMode extends 'db' | 'qb', TTableName extends string | undefined, TSelection extends ColumnsSelection, TSelectMode extends SelectMode> = TBuilderMode extends 'db' ? PgSelect<TTableName, TSelection, TSelectMode> : PgSelectQueryBuilder<PgSelectQueryBuilderHKT, TTableName, TSelection, TSelectMode>;
|
|
17
17
|
export declare class PgSelectBuilder<TSelection extends SelectedFields | undefined, TBuilderMode extends 'db' | 'qb' = 'db'> {
|
|
18
18
|
static readonly [entityKind]: string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { SelectedFields as SelectedFieldsBase, SelectedFieldsFlat as SelectedFieldsFlatBase, SelectedFieldsOrdered as SelectedFieldsOrderedBase } from '../../operations.js';
|
|
2
|
+
import type { PgColumn } from '../columns/index.js';
|
|
3
|
+
import type { PgTable, PgTableWithColumns } from '../table.js';
|
|
4
|
+
import type { PgViewBase, PgViewWithSelection } from '../view.js';
|
|
5
|
+
import type { AppendToNullabilityMap, AppendToResult, GetSelectTableName, JoinNullability, JoinType, MapColumnsToTableAlias, SelectMode } from '../../query-builders/select.types.js';
|
|
6
|
+
import type { Placeholder, SQL, SQLWrapper } from '../../sql/index.js';
|
|
7
|
+
import type { Subquery } from '../../subquery.js';
|
|
8
|
+
import type { Table, UpdateTableConfig } from '../../table.js';
|
|
9
|
+
import type { Assume } from '../../utils.js';
|
|
10
|
+
import { type ColumnsSelection, type View } from '../../view.js';
|
|
11
|
+
import type { PgSelect, PgSelectQueryBuilder } from './select.js';
|
|
12
|
+
export interface Join {
|
|
13
|
+
on: SQL | undefined;
|
|
14
|
+
table: PgTable | Subquery | PgViewBase | SQL;
|
|
15
|
+
alias: string | undefined;
|
|
16
|
+
joinType: JoinType;
|
|
17
|
+
lateral?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export type AnyPgSelect = PgSelect<any, any, any, any>;
|
|
20
|
+
export type BuildAliasTable<TTable extends PgTable | View, TAlias extends string> = TTable extends Table ? PgTableWithColumns<UpdateTableConfig<TTable['_']['config'], {
|
|
21
|
+
name: TAlias;
|
|
22
|
+
columns: MapColumnsToTableAlias<TTable['_']['columns'], TAlias, 'pg'>;
|
|
23
|
+
}>> : TTable extends View ? PgViewWithSelection<TAlias, TTable['_']['existing'], MapColumnsToTableAlias<TTable['_']['selectedFields'], TAlias, 'pg'>> : never;
|
|
24
|
+
export interface PgSelectConfig {
|
|
25
|
+
withList?: Subquery[];
|
|
26
|
+
fields: Record<string, unknown>;
|
|
27
|
+
fieldsFlat?: SelectedFieldsOrdered;
|
|
28
|
+
where?: SQL;
|
|
29
|
+
having?: SQL;
|
|
30
|
+
table: PgTable | Subquery | PgViewBase | SQL;
|
|
31
|
+
limit?: number | Placeholder;
|
|
32
|
+
offset?: number | Placeholder;
|
|
33
|
+
joins?: Join[];
|
|
34
|
+
orderBy?: (PgColumn | SQL | SQL.Aliased)[];
|
|
35
|
+
groupBy?: (PgColumn | SQL | SQL.Aliased)[];
|
|
36
|
+
lockingClauses?: {
|
|
37
|
+
strength: LockStrength;
|
|
38
|
+
config: LockConfig;
|
|
39
|
+
}[];
|
|
40
|
+
distinct?: boolean | {
|
|
41
|
+
on: (PgColumn | SQLWrapper)[];
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export type JoinFn<THKT extends PgSelectHKTBase, TTableName extends string | undefined, TSelectMode extends SelectMode, TJoinType extends JoinType, TSelection, TNullabilityMap extends Record<string, JoinNullability>> = <TJoinedTable extends PgTable | Subquery | PgViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>>(table: TJoinedTable, on: ((aliases: TSelection) => SQL | undefined) | SQL | undefined) => PgSelectKind<THKT, TTableName, AppendToResult<TTableName, TSelection, TJoinedName, TJoinedTable extends Table ? TJoinedTable['_']['columns'] : TJoinedTable extends Subquery ? Assume<TJoinedTable['_']['selectedFields'], SelectedFields> : never, TSelectMode>, TSelectMode extends 'partial' ? TSelectMode : 'multiple', AppendToNullabilityMap<TNullabilityMap, TJoinedName, TJoinType>>;
|
|
45
|
+
export type SelectedFieldsFlat = SelectedFieldsFlatBase<PgColumn>;
|
|
46
|
+
export type SelectedFields = SelectedFieldsBase<PgColumn, PgTable>;
|
|
47
|
+
export type SelectedFieldsOrdered = SelectedFieldsOrderedBase<PgColumn>;
|
|
48
|
+
export type LockStrength = 'update' | 'no key update' | 'share' | 'key share';
|
|
49
|
+
export type LockConfig = {
|
|
50
|
+
of?: PgTable;
|
|
51
|
+
} & ({
|
|
52
|
+
noWait: true;
|
|
53
|
+
skipLocked?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
noWait?: undefined;
|
|
56
|
+
skipLocked: true;
|
|
57
|
+
} | {
|
|
58
|
+
noWait?: undefined;
|
|
59
|
+
skipLocked?: undefined;
|
|
60
|
+
});
|
|
61
|
+
export interface PgSelectHKTBase {
|
|
62
|
+
tableName: string | undefined;
|
|
63
|
+
selection: unknown;
|
|
64
|
+
selectMode: SelectMode;
|
|
65
|
+
nullabilityMap: unknown;
|
|
66
|
+
_type: unknown;
|
|
67
|
+
}
|
|
68
|
+
export type PgSelectKind<T extends PgSelectHKTBase, TTableName extends string | undefined, TSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability>> = (T & {
|
|
69
|
+
tableName: TTableName;
|
|
70
|
+
selection: TSelection;
|
|
71
|
+
selectMode: TSelectMode;
|
|
72
|
+
nullabilityMap: TNullabilityMap;
|
|
73
|
+
})['_type'];
|
|
74
|
+
export interface PgSelectQueryBuilderHKT extends PgSelectHKTBase {
|
|
75
|
+
_type: PgSelectQueryBuilder<this, this['tableName'], Assume<this['selection'], ColumnsSelection>, this['selectMode'], Assume<this['nullabilityMap'], Record<string, JoinNullability>>>;
|
|
76
|
+
}
|
|
77
|
+
export interface PgSelectHKT extends PgSelectHKTBase {
|
|
78
|
+
_type: PgSelect<this['tableName'], Assume<this['selection'], ColumnsSelection>, this['selectMode'], Assume<this['nullabilityMap'], Record<string, JoinNullability>>>;
|
|
79
|
+
}
|