drizzle-orm 1.0.0-beta.21 → 1.0.0-beta.21-af6b4cb
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/_relations.cjs.map +1 -1
- package/_relations.d.cts +2 -13
- package/_relations.d.ts +2 -13
- package/_relations.js.map +1 -1
- package/alias.cjs +1 -1
- package/alias.js +1 -1
- package/aws-data-api/common/index.cjs +2 -0
- package/aws-data-api/common/index.cjs.map +1 -1
- package/aws-data-api/common/index.d.cts +1 -1
- package/aws-data-api/common/index.d.ts +1 -1
- package/aws-data-api/common/index.js +2 -0
- package/aws-data-api/common/index.js.map +1 -1
- package/aws-data-api/pg/driver.cjs +93 -20
- package/aws-data-api/pg/driver.cjs.map +1 -1
- package/aws-data-api/pg/driver.d.cts +17 -13
- package/aws-data-api/pg/driver.d.ts +17 -13
- package/aws-data-api/pg/driver.js +93 -20
- package/aws-data-api/pg/driver.js.map +1 -1
- package/aws-data-api/pg/index.cjs +1 -1
- package/aws-data-api/pg/index.d.cts +3 -3
- package/aws-data-api/pg/index.d.ts +3 -3
- package/aws-data-api/pg/index.js +3 -3
- package/aws-data-api/pg/migrator.cjs.map +1 -1
- package/aws-data-api/pg/migrator.d.cts +1 -1
- package/aws-data-api/pg/migrator.d.ts +1 -1
- package/aws-data-api/pg/migrator.js.map +1 -1
- package/aws-data-api/pg/session.cjs +44 -113
- package/aws-data-api/pg/session.cjs.map +1 -1
- package/aws-data-api/pg/session.d.cts +12 -42
- package/aws-data-api/pg/session.d.ts +13 -43
- package/aws-data-api/pg/session.js +46 -114
- package/aws-data-api/pg/session.js.map +1 -1
- package/better-sqlite3/driver.cjs +5 -2
- package/better-sqlite3/driver.cjs.map +1 -1
- package/better-sqlite3/driver.d.ts +1 -1
- package/better-sqlite3/driver.js +5 -2
- package/better-sqlite3/driver.js.map +1 -1
- package/better-sqlite3/session.cjs +16 -15
- package/better-sqlite3/session.cjs.map +1 -1
- package/better-sqlite3/session.d.cts +10 -6
- package/better-sqlite3/session.d.ts +11 -7
- package/better-sqlite3/session.js +17 -16
- package/better-sqlite3/session.js.map +1 -1
- package/bun-sql/driver.cjs.map +1 -1
- package/bun-sql/driver.d.cts +7 -6
- package/bun-sql/driver.d.ts +7 -6
- package/bun-sql/driver.js.map +1 -1
- package/bun-sql/index.cjs +0 -1
- package/bun-sql/index.d.cts +2 -2
- package/bun-sql/index.d.ts +2 -2
- package/bun-sql/index.js +2 -2
- package/bun-sql/migrator.cjs.map +1 -1
- package/bun-sql/migrator.d.cts +2 -2
- package/bun-sql/migrator.d.ts +2 -2
- package/bun-sql/migrator.js.map +1 -1
- package/bun-sql/mysql/driver.cjs +4 -3
- package/bun-sql/mysql/driver.cjs.map +1 -1
- package/bun-sql/mysql/driver.js +3 -2
- package/bun-sql/mysql/driver.js.map +1 -1
- package/bun-sql/mysql/session.cjs +37 -24
- package/bun-sql/mysql/session.cjs.map +1 -1
- package/bun-sql/mysql/session.d.cts +10 -4
- package/bun-sql/mysql/session.d.ts +12 -6
- package/bun-sql/mysql/session.js +38 -25
- package/bun-sql/mysql/session.js.map +1 -1
- package/bun-sql/postgres/driver.cjs +144 -20
- package/bun-sql/postgres/driver.cjs.map +1 -1
- package/bun-sql/postgres/driver.d.cts +10 -6
- package/bun-sql/postgres/driver.d.ts +11 -7
- package/bun-sql/postgres/driver.js +144 -20
- package/bun-sql/postgres/driver.js.map +1 -1
- package/bun-sql/postgres/index.cjs +1 -1
- package/bun-sql/postgres/index.d.cts +3 -3
- package/bun-sql/postgres/index.d.ts +3 -3
- package/bun-sql/postgres/index.js +3 -3
- package/bun-sql/postgres/migrator.cjs.map +1 -1
- package/bun-sql/postgres/migrator.d.cts +1 -1
- package/bun-sql/postgres/migrator.d.ts +1 -1
- package/bun-sql/postgres/migrator.js.map +1 -1
- package/bun-sql/postgres/session.cjs +17 -112
- package/bun-sql/postgres/session.cjs.map +1 -1
- package/bun-sql/postgres/session.d.cts +11 -33
- package/bun-sql/postgres/session.d.ts +12 -34
- package/bun-sql/postgres/session.js +18 -112
- package/bun-sql/postgres/session.js.map +1 -1
- package/bun-sql/session.cjs +0 -1
- package/bun-sql/session.d.cts +2 -2
- package/bun-sql/session.d.ts +2 -2
- package/bun-sql/session.js +2 -2
- package/bun-sql/sqlite/driver.cjs +4 -3
- package/bun-sql/sqlite/driver.cjs.map +1 -1
- package/bun-sql/sqlite/driver.d.ts +1 -1
- package/bun-sql/sqlite/driver.js +3 -2
- package/bun-sql/sqlite/driver.js.map +1 -1
- package/bun-sql/sqlite/session.cjs +18 -17
- package/bun-sql/sqlite/session.cjs.map +1 -1
- package/bun-sql/sqlite/session.d.cts +9 -6
- package/bun-sql/sqlite/session.d.ts +10 -7
- package/bun-sql/sqlite/session.js +19 -18
- package/bun-sql/sqlite/session.js.map +1 -1
- package/bun-sqlite/driver.cjs +5 -2
- package/bun-sqlite/driver.cjs.map +1 -1
- package/bun-sqlite/driver.d.ts +1 -1
- package/bun-sqlite/driver.js +5 -2
- package/bun-sqlite/driver.js.map +1 -1
- package/bun-sqlite/session.cjs +15 -14
- package/bun-sqlite/session.cjs.map +1 -1
- package/bun-sqlite/session.d.cts +10 -6
- package/bun-sqlite/session.d.ts +10 -6
- package/bun-sqlite/session.js +16 -15
- package/bun-sqlite/session.js.map +1 -1
- package/cache/core/cache-effect.cjs +2 -2
- package/cache/core/cache-effect.d.ts +1 -1
- package/cache/core/cache-effect.js +1 -1
- package/cockroach/driver.cjs +10 -4
- package/cockroach/driver.cjs.map +1 -1
- package/cockroach/driver.d.cts +1 -0
- package/cockroach/driver.d.ts +3 -2
- package/cockroach/driver.js +10 -4
- package/cockroach/driver.js.map +1 -1
- package/cockroach/session.cjs +7 -9
- package/cockroach/session.cjs.map +1 -1
- package/cockroach/session.d.cts +5 -3
- package/cockroach/session.d.ts +7 -5
- package/cockroach/session.js +8 -10
- package/cockroach/session.js.map +1 -1
- package/cockroach-core/columns/bigint.cjs +4 -4
- package/cockroach-core/columns/bigint.cjs.map +1 -1
- package/cockroach-core/columns/bigint.d.cts +2 -2
- package/cockroach-core/columns/bigint.d.ts +2 -2
- package/cockroach-core/columns/bigint.js +4 -4
- package/cockroach-core/columns/bigint.js.map +1 -1
- package/cockroach-core/columns/common.cjs +5 -5
- package/cockroach-core/columns/common.cjs.map +1 -1
- package/cockroach-core/columns/common.d.cts +2 -2
- package/cockroach-core/columns/common.d.ts +3 -3
- package/cockroach-core/columns/common.js +5 -5
- package/cockroach-core/columns/common.js.map +1 -1
- package/cockroach-core/columns/custom.cjs +4 -4
- package/cockroach-core/columns/custom.cjs.map +1 -1
- package/cockroach-core/columns/custom.d.cts +2 -2
- package/cockroach-core/columns/custom.d.ts +2 -2
- package/cockroach-core/columns/custom.js +4 -4
- package/cockroach-core/columns/custom.js.map +1 -1
- package/cockroach-core/columns/date.cjs +6 -6
- package/cockroach-core/columns/date.cjs.map +1 -1
- package/cockroach-core/columns/date.d.cts +3 -3
- package/cockroach-core/columns/date.d.ts +3 -3
- package/cockroach-core/columns/date.js +6 -6
- package/cockroach-core/columns/date.js.map +1 -1
- package/cockroach-core/columns/decimal.cjs +4 -4
- package/cockroach-core/columns/decimal.cjs.map +1 -1
- package/cockroach-core/columns/decimal.d.cts +2 -2
- package/cockroach-core/columns/decimal.d.ts +2 -2
- package/cockroach-core/columns/decimal.js +4 -4
- package/cockroach-core/columns/decimal.js.map +1 -1
- package/cockroach-core/columns/float.cjs +2 -2
- package/cockroach-core/columns/float.cjs.map +1 -1
- package/cockroach-core/columns/float.d.cts +1 -1
- package/cockroach-core/columns/float.d.ts +1 -1
- package/cockroach-core/columns/float.js +2 -2
- package/cockroach-core/columns/float.js.map +1 -1
- package/cockroach-core/columns/geometry.cjs +8 -8
- package/cockroach-core/columns/geometry.cjs.map +1 -1
- package/cockroach-core/columns/geometry.d.cts +5 -5
- package/cockroach-core/columns/geometry.d.ts +5 -5
- package/cockroach-core/columns/geometry.js +8 -8
- package/cockroach-core/columns/geometry.js.map +1 -1
- package/cockroach-core/columns/integer.cjs +2 -2
- package/cockroach-core/columns/integer.cjs.map +1 -1
- package/cockroach-core/columns/integer.d.cts +1 -1
- package/cockroach-core/columns/integer.d.ts +1 -1
- package/cockroach-core/columns/integer.js +2 -2
- package/cockroach-core/columns/integer.js.map +1 -1
- package/cockroach-core/columns/jsonb.cjs +4 -4
- package/cockroach-core/columns/jsonb.cjs.map +1 -1
- package/cockroach-core/columns/jsonb.d.cts +2 -2
- package/cockroach-core/columns/jsonb.d.ts +2 -2
- package/cockroach-core/columns/jsonb.js +4 -4
- package/cockroach-core/columns/jsonb.js.map +1 -1
- package/cockroach-core/columns/vector.cjs +4 -4
- package/cockroach-core/columns/vector.cjs.map +1 -1
- package/cockroach-core/columns/vector.d.cts +2 -2
- package/cockroach-core/columns/vector.d.ts +2 -2
- package/cockroach-core/columns/vector.js +4 -4
- package/cockroach-core/columns/vector.js.map +1 -1
- package/cockroach-core/db.cjs +1 -1
- package/cockroach-core/db.cjs.map +1 -1
- package/cockroach-core/db.d.ts +2 -2
- package/cockroach-core/db.js +1 -1
- package/cockroach-core/db.js.map +1 -1
- package/cockroach-core/dialect.cjs +2 -2
- package/cockroach-core/dialect.d.ts +2 -2
- package/cockroach-core/dialect.js +2 -2
- package/cockroach-core/index.cjs +14 -14
- package/cockroach-core/index.js +14 -14
- package/cockroach-core/query-builders/delete.cjs +1 -1
- package/cockroach-core/query-builders/delete.cjs.map +1 -1
- package/cockroach-core/query-builders/delete.d.cts +1 -1
- package/cockroach-core/query-builders/delete.d.ts +2 -2
- package/cockroach-core/query-builders/delete.js +1 -1
- package/cockroach-core/query-builders/delete.js.map +1 -1
- package/cockroach-core/query-builders/index.cjs +2 -2
- package/cockroach-core/query-builders/index.js +2 -2
- package/cockroach-core/query-builders/insert.cjs +1 -1
- package/cockroach-core/query-builders/insert.cjs.map +1 -1
- package/cockroach-core/query-builders/insert.d.ts +1 -1
- package/cockroach-core/query-builders/insert.js +1 -1
- package/cockroach-core/query-builders/insert.js.map +1 -1
- package/cockroach-core/query-builders/query.cjs +1 -1
- package/cockroach-core/query-builders/query.cjs.map +1 -1
- package/cockroach-core/query-builders/query.js +1 -1
- package/cockroach-core/query-builders/query.js.map +1 -1
- package/cockroach-core/query-builders/raw.cjs +0 -4
- package/cockroach-core/query-builders/raw.cjs.map +1 -1
- package/cockroach-core/query-builders/raw.js +0 -4
- package/cockroach-core/query-builders/raw.js.map +1 -1
- package/cockroach-core/query-builders/refresh-materialized-view.cjs +1 -1
- package/cockroach-core/query-builders/refresh-materialized-view.cjs.map +1 -1
- package/cockroach-core/query-builders/refresh-materialized-view.js +1 -1
- package/cockroach-core/query-builders/refresh-materialized-view.js.map +1 -1
- package/cockroach-core/query-builders/select.cjs +2 -2
- package/cockroach-core/query-builders/select.cjs.map +1 -1
- package/cockroach-core/query-builders/select.d.ts +3 -3
- package/cockroach-core/query-builders/select.js +2 -2
- package/cockroach-core/query-builders/select.js.map +1 -1
- package/cockroach-core/query-builders/select.types.d.ts +1 -1
- package/cockroach-core/query-builders/update.cjs +2 -2
- package/cockroach-core/query-builders/update.cjs.map +1 -1
- package/cockroach-core/query-builders/update.d.ts +1 -1
- package/cockroach-core/query-builders/update.js +2 -2
- package/cockroach-core/query-builders/update.js.map +1 -1
- package/cockroach-core/schema.cjs +1 -1
- package/cockroach-core/schema.js +1 -1
- package/cockroach-core/session.cjs +2 -2
- package/cockroach-core/session.cjs.map +1 -1
- package/cockroach-core/session.d.cts +1 -1
- package/cockroach-core/session.d.ts +1 -1
- package/cockroach-core/session.js +2 -2
- package/cockroach-core/session.js.map +1 -1
- package/cockroach-core/table.cjs +1 -1
- package/cockroach-core/table.cjs.map +1 -1
- package/cockroach-core/table.js +1 -1
- package/cockroach-core/table.js.map +1 -1
- package/cockroach-core/utils.cjs +3 -3
- package/cockroach-core/utils.js +3 -3
- package/cockroach-core/view.cjs +1 -1
- package/cockroach-core/view.js +1 -1
- package/codecs.cjs +77 -0
- package/codecs.cjs.map +1 -0
- package/codecs.d.cts +68 -0
- package/codecs.d.ts +68 -0
- package/codecs.js +74 -0
- package/codecs.js.map +1 -0
- package/column.cjs +10 -5
- package/column.cjs.map +1 -1
- package/column.d.cts +3 -3
- package/column.d.ts +3 -3
- package/column.js +10 -5
- package/column.js.map +1 -1
- package/d1/driver.cjs +3 -2
- package/d1/driver.cjs.map +1 -1
- package/d1/driver.d.ts +1 -1
- package/d1/driver.js +3 -2
- package/d1/driver.js.map +1 -1
- package/d1/session.cjs +17 -15
- package/d1/session.cjs.map +1 -1
- package/d1/session.d.cts +9 -6
- package/d1/session.d.ts +10 -7
- package/d1/session.js +18 -16
- package/d1/session.js.map +1 -1
- package/durable-sqlite/driver.cjs +5 -2
- package/durable-sqlite/driver.cjs.map +1 -1
- package/durable-sqlite/driver.d.ts +1 -1
- package/durable-sqlite/driver.js +5 -2
- package/durable-sqlite/driver.js.map +1 -1
- package/durable-sqlite/migrator.cjs +1 -1
- package/durable-sqlite/migrator.js +1 -1
- package/durable-sqlite/session.cjs +15 -14
- package/durable-sqlite/session.cjs.map +1 -1
- package/durable-sqlite/session.d.cts +10 -6
- package/durable-sqlite/session.d.ts +10 -6
- package/durable-sqlite/session.js +16 -15
- package/durable-sqlite/session.js.map +1 -1
- package/effect-core/index.cjs +1 -1
- package/effect-core/index.js +1 -1
- package/effect-postgres/driver.cjs +100 -14
- package/effect-postgres/driver.cjs.map +1 -1
- package/effect-postgres/driver.d.cts +12 -8
- package/effect-postgres/driver.d.ts +14 -10
- package/effect-postgres/driver.js +100 -14
- package/effect-postgres/driver.js.map +1 -1
- package/effect-postgres/index.cjs +1 -1
- package/effect-postgres/index.d.cts +3 -3
- package/effect-postgres/index.d.ts +3 -3
- package/effect-postgres/index.js +3 -3
- package/effect-postgres/migrator.cjs.map +1 -1
- package/effect-postgres/migrator.d.cts +1 -1
- package/effect-postgres/migrator.d.ts +2 -2
- package/effect-postgres/migrator.js.map +1 -1
- package/effect-postgres/session.cjs +12 -71
- package/effect-postgres/session.cjs.map +1 -1
- package/effect-postgres/session.d.cts +14 -31
- package/effect-postgres/session.d.ts +17 -34
- package/effect-postgres/session.js +13 -71
- package/effect-postgres/session.js.map +1 -1
- package/effect-schema/column.cjs +1 -1
- package/effect-schema/column.d.ts +8 -8
- package/effect-schema/column.js +1 -1
- package/effect-schema/column.types.d.ts +14 -14
- package/effect-schema/schema.types.internal.d.ts +7 -7
- package/expo-sqlite/driver.cjs +5 -2
- package/expo-sqlite/driver.cjs.map +1 -1
- package/expo-sqlite/driver.d.ts +1 -1
- package/expo-sqlite/driver.js +5 -2
- package/expo-sqlite/driver.js.map +1 -1
- package/expo-sqlite/session.cjs +15 -14
- package/expo-sqlite/session.cjs.map +1 -1
- package/expo-sqlite/session.d.cts +10 -6
- package/expo-sqlite/session.d.ts +10 -6
- package/expo-sqlite/session.js +16 -15
- package/expo-sqlite/session.js.map +1 -1
- package/gel/driver.cjs +5 -3
- package/gel/driver.cjs.map +1 -1
- package/gel/driver.d.cts +1 -0
- package/gel/driver.d.ts +5 -4
- package/gel/driver.js +5 -3
- package/gel/driver.js.map +1 -1
- package/gel/session.cjs +13 -13
- package/gel/session.cjs.map +1 -1
- package/gel/session.d.cts +8 -5
- package/gel/session.d.ts +12 -9
- package/gel/session.js +14 -14
- package/gel/session.js.map +1 -1
- package/gel-core/columns/bigintT.cjs +2 -2
- package/gel-core/columns/bigintT.cjs.map +1 -1
- package/gel-core/columns/bigintT.d.cts +1 -1
- package/gel-core/columns/bigintT.d.ts +1 -1
- package/gel-core/columns/bigintT.js +2 -2
- package/gel-core/columns/bigintT.js.map +1 -1
- package/gel-core/columns/common.cjs +3 -3
- package/gel-core/columns/common.cjs.map +1 -1
- package/gel-core/columns/common.d.cts +1 -1
- package/gel-core/columns/common.d.ts +1 -1
- package/gel-core/columns/common.js +3 -3
- package/gel-core/columns/common.js.map +1 -1
- package/gel-core/columns/custom.cjs +4 -4
- package/gel-core/columns/custom.cjs.map +1 -1
- package/gel-core/columns/custom.d.cts +2 -2
- package/gel-core/columns/custom.d.ts +2 -2
- package/gel-core/columns/custom.js +4 -4
- package/gel-core/columns/custom.js.map +1 -1
- package/gel-core/columns/double-precision.cjs +2 -2
- package/gel-core/columns/double-precision.cjs.map +1 -1
- package/gel-core/columns/double-precision.d.cts +1 -1
- package/gel-core/columns/double-precision.d.ts +1 -1
- package/gel-core/columns/double-precision.js +2 -2
- package/gel-core/columns/double-precision.js.map +1 -1
- package/gel-core/columns/timestamp.d.ts +1 -1
- package/gel-core/columns/timestamptz.cjs +2 -2
- package/gel-core/columns/timestamptz.cjs.map +1 -1
- package/gel-core/columns/timestamptz.d.cts +1 -1
- package/gel-core/columns/timestamptz.d.ts +1 -1
- package/gel-core/columns/timestamptz.js +2 -2
- package/gel-core/columns/timestamptz.js.map +1 -1
- package/gel-core/db.cjs +1 -1
- package/gel-core/db.cjs.map +1 -1
- package/gel-core/db.d.ts +3 -3
- package/gel-core/db.js +1 -1
- package/gel-core/db.js.map +1 -1
- package/gel-core/index.cjs +13 -13
- package/gel-core/index.js +13 -13
- package/gel-core/query-builders/_query.cjs +1 -1
- package/gel-core/query-builders/_query.cjs.map +1 -1
- package/gel-core/query-builders/_query.js +1 -1
- package/gel-core/query-builders/_query.js.map +1 -1
- package/gel-core/query-builders/delete.cjs +1 -1
- package/gel-core/query-builders/delete.cjs.map +1 -1
- package/gel-core/query-builders/delete.d.ts +2 -2
- package/gel-core/query-builders/delete.js +1 -1
- package/gel-core/query-builders/delete.js.map +1 -1
- package/gel-core/query-builders/index.cjs +1 -1
- package/gel-core/query-builders/index.js +1 -1
- package/gel-core/query-builders/insert.cjs +1 -1
- package/gel-core/query-builders/insert.cjs.map +1 -1
- package/gel-core/query-builders/insert.d.ts +2 -2
- package/gel-core/query-builders/insert.js +1 -1
- package/gel-core/query-builders/insert.js.map +1 -1
- package/gel-core/query-builders/query.cjs +13 -5
- package/gel-core/query-builders/query.cjs.map +1 -1
- package/gel-core/query-builders/query.d.ts +1 -1
- package/gel-core/query-builders/query.js +13 -5
- package/gel-core/query-builders/query.js.map +1 -1
- package/gel-core/query-builders/raw.cjs +0 -4
- package/gel-core/query-builders/raw.cjs.map +1 -1
- package/gel-core/query-builders/raw.js +0 -4
- package/gel-core/query-builders/raw.js.map +1 -1
- package/gel-core/query-builders/refresh-materialized-view.cjs +1 -1
- package/gel-core/query-builders/refresh-materialized-view.cjs.map +1 -1
- package/gel-core/query-builders/refresh-materialized-view.d.ts +1 -1
- package/gel-core/query-builders/refresh-materialized-view.js +1 -1
- package/gel-core/query-builders/refresh-materialized-view.js.map +1 -1
- package/gel-core/query-builders/select.cjs +1 -1
- package/gel-core/query-builders/select.cjs.map +1 -1
- package/gel-core/query-builders/select.d.ts +3 -3
- package/gel-core/query-builders/select.js +1 -1
- package/gel-core/query-builders/select.js.map +1 -1
- package/gel-core/query-builders/select.types.d.ts +1 -1
- package/gel-core/query-builders/update.cjs +1 -1
- package/gel-core/query-builders/update.cjs.map +1 -1
- package/gel-core/query-builders/update.d.ts +2 -2
- package/gel-core/query-builders/update.js +1 -1
- package/gel-core/query-builders/update.js.map +1 -1
- package/gel-core/session.cjs +2 -2
- package/gel-core/session.cjs.map +1 -1
- package/gel-core/session.d.cts +3 -3
- package/gel-core/session.d.ts +3 -3
- package/gel-core/session.js +2 -2
- package/gel-core/session.js.map +1 -1
- package/gel-core/table.cjs +1 -1
- package/gel-core/table.cjs.map +1 -1
- package/gel-core/table.js +1 -1
- package/gel-core/table.js.map +1 -1
- package/gel-core/utils.cjs +4 -4
- package/gel-core/utils.js +4 -4
- package/gel-core/view.cjs +1 -1
- package/gel-core/view.js +1 -1
- package/index.cjs +12 -6
- package/index.d.cts +6 -6
- package/index.d.ts +6 -6
- package/index.js +9 -9
- package/libsql/driver-core.cjs +3 -2
- package/libsql/driver-core.cjs.map +1 -1
- package/libsql/driver-core.d.ts +1 -1
- package/libsql/driver-core.js +3 -2
- package/libsql/driver-core.js.map +1 -1
- package/libsql/session.cjs +14 -15
- package/libsql/session.cjs.map +1 -1
- package/libsql/session.d.cts +9 -6
- package/libsql/session.d.ts +10 -7
- package/libsql/session.js +15 -16
- package/libsql/session.js.map +1 -1
- package/mssql-core/columns/bigint.cjs +2 -2
- package/mssql-core/columns/bigint.cjs.map +1 -1
- package/mssql-core/columns/bigint.d.cts +1 -1
- package/mssql-core/columns/bigint.d.ts +1 -1
- package/mssql-core/columns/bigint.js +2 -2
- package/mssql-core/columns/bigint.js.map +1 -1
- package/mssql-core/columns/custom.cjs +4 -4
- package/mssql-core/columns/custom.cjs.map +1 -1
- package/mssql-core/columns/custom.d.cts +2 -2
- package/mssql-core/columns/custom.d.ts +2 -2
- package/mssql-core/columns/custom.js +4 -4
- package/mssql-core/columns/custom.js.map +1 -1
- package/mssql-core/columns/date.cjs +4 -4
- package/mssql-core/columns/date.cjs.map +1 -1
- package/mssql-core/columns/date.d.cts +2 -2
- package/mssql-core/columns/date.d.ts +2 -2
- package/mssql-core/columns/date.js +4 -4
- package/mssql-core/columns/date.js.map +1 -1
- package/mssql-core/columns/datetime.cjs +2 -2
- package/mssql-core/columns/datetime.cjs.map +1 -1
- package/mssql-core/columns/datetime.d.cts +1 -1
- package/mssql-core/columns/datetime.d.ts +1 -1
- package/mssql-core/columns/datetime.js +2 -2
- package/mssql-core/columns/datetime.js.map +1 -1
- package/mssql-core/columns/datetime2.cjs +2 -2
- package/mssql-core/columns/datetime2.cjs.map +1 -1
- package/mssql-core/columns/datetime2.d.cts +1 -1
- package/mssql-core/columns/datetime2.d.ts +1 -1
- package/mssql-core/columns/datetime2.js +2 -2
- package/mssql-core/columns/datetime2.js.map +1 -1
- package/mssql-core/columns/datetimeoffset.cjs +2 -2
- package/mssql-core/columns/datetimeoffset.cjs.map +1 -1
- package/mssql-core/columns/datetimeoffset.d.cts +1 -1
- package/mssql-core/columns/datetimeoffset.d.ts +1 -1
- package/mssql-core/columns/datetimeoffset.js +2 -2
- package/mssql-core/columns/datetimeoffset.js.map +1 -1
- package/mssql-core/columns/decimal.cjs +4 -4
- package/mssql-core/columns/decimal.cjs.map +1 -1
- package/mssql-core/columns/decimal.d.cts +2 -2
- package/mssql-core/columns/decimal.d.ts +2 -2
- package/mssql-core/columns/decimal.js +4 -4
- package/mssql-core/columns/decimal.js.map +1 -1
- package/mssql-core/columns/numeric.cjs +4 -4
- package/mssql-core/columns/numeric.cjs.map +1 -1
- package/mssql-core/columns/numeric.d.cts +2 -2
- package/mssql-core/columns/numeric.d.ts +2 -2
- package/mssql-core/columns/numeric.js +4 -4
- package/mssql-core/columns/numeric.js.map +1 -1
- package/mssql-core/columns/smallint.cjs +2 -2
- package/mssql-core/columns/smallint.cjs.map +1 -1
- package/mssql-core/columns/smallint.d.cts +1 -1
- package/mssql-core/columns/smallint.d.ts +1 -1
- package/mssql-core/columns/smallint.js +2 -2
- package/mssql-core/columns/smallint.js.map +1 -1
- package/mssql-core/columns/time.cjs +2 -2
- package/mssql-core/columns/time.cjs.map +1 -1
- package/mssql-core/columns/time.d.cts +1 -1
- package/mssql-core/columns/time.d.ts +1 -1
- package/mssql-core/columns/time.js +2 -2
- package/mssql-core/columns/time.js.map +1 -1
- package/mssql-core/columns/tinyint.cjs +2 -2
- package/mssql-core/columns/tinyint.cjs.map +1 -1
- package/mssql-core/columns/tinyint.d.cts +1 -1
- package/mssql-core/columns/tinyint.d.ts +1 -1
- package/mssql-core/columns/tinyint.js +2 -2
- package/mssql-core/columns/tinyint.js.map +1 -1
- package/mssql-core/columns/varchar.cjs +4 -4
- package/mssql-core/columns/varchar.cjs.map +1 -1
- package/mssql-core/columns/varchar.d.cts +2 -2
- package/mssql-core/columns/varchar.d.ts +2 -2
- package/mssql-core/columns/varchar.js +4 -4
- package/mssql-core/columns/varchar.js.map +1 -1
- package/mssql-core/dialect.cjs +2 -2
- package/mssql-core/dialect.d.ts +1 -1
- package/mssql-core/dialect.js +2 -2
- package/mssql-core/index.cjs +13 -13
- package/mssql-core/index.js +13 -13
- package/mssql-core/query-builders/delete.d.ts +1 -1
- package/mssql-core/query-builders/insert.d.ts +1 -1
- package/mssql-core/query-builders/select.d.ts +1 -1
- package/mssql-core/query-builders/update.d.ts +2 -2
- package/mssql-core/table.cjs +1 -1
- package/mssql-core/table.cjs.map +1 -1
- package/mssql-core/table.js +1 -1
- package/mssql-core/table.js.map +1 -1
- package/mssql-core/utils.cjs +3 -3
- package/mssql-core/utils.js +3 -3
- package/mssql-core/view.cjs +2 -2
- package/mssql-core/view.js +2 -2
- package/mysql-core/columns/bigint.cjs +8 -8
- package/mysql-core/columns/bigint.cjs.map +1 -1
- package/mysql-core/columns/bigint.d.cts +4 -4
- package/mysql-core/columns/bigint.d.ts +4 -4
- package/mysql-core/columns/bigint.js +8 -8
- package/mysql-core/columns/bigint.js.map +1 -1
- package/mysql-core/columns/binary.cjs +2 -2
- package/mysql-core/columns/binary.cjs.map +1 -1
- package/mysql-core/columns/binary.d.cts +1 -1
- package/mysql-core/columns/binary.d.ts +1 -1
- package/mysql-core/columns/binary.js +2 -2
- package/mysql-core/columns/binary.js.map +1 -1
- package/mysql-core/columns/blob.cjs +4 -4
- package/mysql-core/columns/blob.cjs.map +1 -1
- package/mysql-core/columns/blob.d.cts +2 -2
- package/mysql-core/columns/blob.d.ts +2 -2
- package/mysql-core/columns/blob.js +4 -4
- package/mysql-core/columns/blob.js.map +1 -1
- package/mysql-core/columns/boolean.cjs +2 -2
- package/mysql-core/columns/boolean.cjs.map +1 -1
- package/mysql-core/columns/boolean.d.cts +1 -1
- package/mysql-core/columns/boolean.d.ts +1 -1
- package/mysql-core/columns/boolean.js +2 -2
- package/mysql-core/columns/boolean.js.map +1 -1
- package/mysql-core/columns/custom.cjs +4 -4
- package/mysql-core/columns/custom.cjs.map +1 -1
- package/mysql-core/columns/custom.d.cts +2 -2
- package/mysql-core/columns/custom.d.ts +2 -2
- package/mysql-core/columns/custom.js +4 -4
- package/mysql-core/columns/custom.js.map +1 -1
- package/mysql-core/columns/date.cjs +4 -4
- package/mysql-core/columns/date.cjs.map +1 -1
- package/mysql-core/columns/date.d.cts +2 -2
- package/mysql-core/columns/date.d.ts +2 -2
- package/mysql-core/columns/date.js +4 -4
- package/mysql-core/columns/date.js.map +1 -1
- package/mysql-core/columns/datetime.cjs +8 -8
- package/mysql-core/columns/datetime.cjs.map +1 -1
- package/mysql-core/columns/datetime.d.cts +4 -4
- package/mysql-core/columns/datetime.d.ts +4 -4
- package/mysql-core/columns/datetime.js +8 -8
- package/mysql-core/columns/datetime.js.map +1 -1
- package/mysql-core/columns/decimal.cjs +4 -4
- package/mysql-core/columns/decimal.cjs.map +1 -1
- package/mysql-core/columns/decimal.d.cts +2 -2
- package/mysql-core/columns/decimal.d.ts +2 -2
- package/mysql-core/columns/decimal.js +4 -4
- package/mysql-core/columns/decimal.js.map +1 -1
- package/mysql-core/columns/float.cjs +2 -2
- package/mysql-core/columns/float.cjs.map +1 -1
- package/mysql-core/columns/float.d.cts +1 -1
- package/mysql-core/columns/float.d.ts +1 -1
- package/mysql-core/columns/float.js +2 -2
- package/mysql-core/columns/float.js.map +1 -1
- package/mysql-core/columns/int.cjs +2 -2
- package/mysql-core/columns/int.cjs.map +1 -1
- package/mysql-core/columns/int.d.cts +1 -1
- package/mysql-core/columns/int.d.ts +1 -1
- package/mysql-core/columns/int.js +2 -2
- package/mysql-core/columns/int.js.map +1 -1
- package/mysql-core/columns/json.cjs +2 -2
- package/mysql-core/columns/json.cjs.map +1 -1
- package/mysql-core/columns/json.d.cts +1 -1
- package/mysql-core/columns/json.d.ts +1 -1
- package/mysql-core/columns/json.js +2 -2
- package/mysql-core/columns/json.js.map +1 -1
- package/mysql-core/columns/mediumint.cjs +2 -2
- package/mysql-core/columns/mediumint.cjs.map +1 -1
- package/mysql-core/columns/mediumint.d.cts +1 -1
- package/mysql-core/columns/mediumint.d.ts +1 -1
- package/mysql-core/columns/mediumint.js +2 -2
- package/mysql-core/columns/mediumint.js.map +1 -1
- package/mysql-core/columns/serial.cjs +2 -2
- package/mysql-core/columns/serial.cjs.map +1 -1
- package/mysql-core/columns/serial.d.cts +1 -1
- package/mysql-core/columns/serial.d.ts +1 -1
- package/mysql-core/columns/serial.js +2 -2
- package/mysql-core/columns/serial.js.map +1 -1
- package/mysql-core/columns/smallint.cjs +2 -2
- package/mysql-core/columns/smallint.cjs.map +1 -1
- package/mysql-core/columns/smallint.d.cts +1 -1
- package/mysql-core/columns/smallint.d.ts +1 -1
- package/mysql-core/columns/smallint.js +2 -2
- package/mysql-core/columns/smallint.js.map +1 -1
- package/mysql-core/columns/time.cjs +2 -2
- package/mysql-core/columns/time.cjs.map +1 -1
- package/mysql-core/columns/time.d.cts +1 -1
- package/mysql-core/columns/time.d.ts +1 -1
- package/mysql-core/columns/time.js +2 -2
- package/mysql-core/columns/time.js.map +1 -1
- package/mysql-core/columns/timestamp.cjs +8 -8
- package/mysql-core/columns/timestamp.cjs.map +1 -1
- package/mysql-core/columns/timestamp.d.cts +4 -4
- package/mysql-core/columns/timestamp.d.ts +4 -4
- package/mysql-core/columns/timestamp.js +8 -8
- package/mysql-core/columns/timestamp.js.map +1 -1
- package/mysql-core/columns/tinyint.cjs +2 -2
- package/mysql-core/columns/tinyint.cjs.map +1 -1
- package/mysql-core/columns/tinyint.d.cts +1 -1
- package/mysql-core/columns/tinyint.d.ts +1 -1
- package/mysql-core/columns/tinyint.js +2 -2
- package/mysql-core/columns/tinyint.js.map +1 -1
- package/mysql-core/columns/varbinary.cjs +2 -2
- package/mysql-core/columns/varbinary.cjs.map +1 -1
- package/mysql-core/columns/varbinary.d.cts +1 -1
- package/mysql-core/columns/varbinary.d.ts +1 -1
- package/mysql-core/columns/varbinary.js +2 -2
- package/mysql-core/columns/varbinary.js.map +1 -1
- package/mysql-core/columns/year.cjs +2 -2
- package/mysql-core/columns/year.cjs.map +1 -1
- package/mysql-core/columns/year.d.cts +1 -1
- package/mysql-core/columns/year.d.ts +1 -1
- package/mysql-core/columns/year.js +2 -2
- package/mysql-core/columns/year.js.map +1 -1
- package/mysql-core/db.d.ts +2 -2
- package/mysql-core/dialect.cjs +2 -2
- package/mysql-core/dialect.d.ts +1 -1
- package/mysql-core/dialect.js +2 -2
- package/mysql-core/index.cjs +1 -1
- package/mysql-core/index.js +1 -1
- package/mysql-core/query-builders/query.cjs +13 -5
- package/mysql-core/query-builders/query.cjs.map +1 -1
- package/mysql-core/query-builders/query.d.ts +1 -1
- package/mysql-core/query-builders/query.js +13 -5
- package/mysql-core/query-builders/query.js.map +1 -1
- package/mysql-core/session.cjs +1 -2
- package/mysql-core/session.cjs.map +1 -1
- package/mysql-core/session.d.cts +3 -4
- package/mysql-core/session.d.ts +3 -4
- package/mysql-core/session.js +1 -2
- package/mysql-core/session.js.map +1 -1
- package/mysql-core/table.cjs +1 -1
- package/mysql-core/table.cjs.map +1 -1
- package/mysql-core/table.js +1 -1
- package/mysql-core/table.js.map +1 -1
- package/mysql-proxy/driver.cjs +5 -2
- package/mysql-proxy/driver.cjs.map +1 -1
- package/mysql-proxy/driver.js +5 -2
- package/mysql-proxy/driver.js.map +1 -1
- package/mysql-proxy/session.cjs +26 -19
- package/mysql-proxy/session.cjs.map +1 -1
- package/mysql-proxy/session.d.cts +11 -4
- package/mysql-proxy/session.d.ts +13 -6
- package/mysql-proxy/session.js +27 -20
- package/mysql-proxy/session.js.map +1 -1
- package/mysql2/driver.cjs +3 -2
- package/mysql2/driver.cjs.map +1 -1
- package/mysql2/driver.d.cts +1 -0
- package/mysql2/driver.d.ts +4 -3
- package/mysql2/driver.js +3 -2
- package/mysql2/driver.js.map +1 -1
- package/mysql2/session.cjs +49 -39
- package/mysql2/session.cjs.map +1 -1
- package/mysql2/session.d.cts +11 -4
- package/mysql2/session.d.ts +13 -6
- package/mysql2/session.js +50 -40
- package/mysql2/session.js.map +1 -1
- package/neon-http/driver.cjs +34 -65
- package/neon-http/driver.cjs.map +1 -1
- package/neon-http/driver.d.cts +15 -19
- package/neon-http/driver.d.ts +16 -20
- package/neon-http/driver.js +34 -64
- package/neon-http/driver.js.map +1 -1
- package/neon-http/index.cjs +2 -4
- package/neon-http/index.d.cts +3 -3
- package/neon-http/index.d.ts +3 -3
- package/neon-http/index.js +3 -3
- package/neon-http/migrator.cjs +1 -1
- package/neon-http/migrator.cjs.map +1 -1
- package/neon-http/migrator.d.cts +1 -1
- package/neon-http/migrator.d.ts +1 -1
- package/neon-http/migrator.js +1 -1
- package/neon-http/migrator.js.map +1 -1
- package/neon-http/session.cjs +28 -117
- package/neon-http/session.cjs.map +1 -1
- package/neon-http/session.d.cts +10 -38
- package/neon-http/session.d.ts +12 -40
- package/neon-http/session.js +30 -117
- package/neon-http/session.js.map +1 -1
- package/neon-serverless/driver.cjs +14 -32
- package/neon-serverless/driver.cjs.map +1 -1
- package/neon-serverless/driver.d.cts +12 -17
- package/neon-serverless/driver.d.ts +13 -18
- package/neon-serverless/driver.js +14 -31
- package/neon-serverless/driver.js.map +1 -1
- package/neon-serverless/index.cjs +2 -3
- package/neon-serverless/index.d.cts +3 -3
- package/neon-serverless/index.d.ts +3 -3
- package/neon-serverless/index.js +3 -3
- package/neon-serverless/migrator.cjs.map +1 -1
- package/neon-serverless/migrator.d.cts +1 -1
- package/neon-serverless/migrator.d.ts +1 -1
- package/neon-serverless/migrator.js.map +1 -1
- package/neon-serverless/session.cjs +32 -108
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.d.cts +9 -32
- package/neon-serverless/session.d.ts +10 -33
- package/neon-serverless/session.js +34 -109
- package/neon-serverless/session.js.map +1 -1
- package/netlify-db/driver.cjs +36 -43
- package/netlify-db/driver.cjs.map +1 -1
- package/netlify-db/driver.d.cts +29 -29
- package/netlify-db/driver.d.ts +31 -31
- package/netlify-db/driver.js +35 -42
- package/netlify-db/driver.js.map +1 -1
- package/netlify-db/index.cjs +3 -2
- package/netlify-db/index.d.cts +3 -3
- package/netlify-db/index.d.ts +3 -3
- package/netlify-db/index.js +2 -2
- package/netlify-db/migrator.cjs.map +1 -1
- package/netlify-db/migrator.d.cts +1 -1
- package/netlify-db/migrator.d.ts +1 -1
- package/netlify-db/migrator.js.map +1 -1
- package/netlify-db/session.cjs +61 -39
- package/netlify-db/session.cjs.map +1 -1
- package/netlify-db/session.d.cts +22 -23
- package/netlify-db/session.d.ts +24 -25
- package/netlify-db/session.js +63 -41
- package/netlify-db/session.js.map +1 -1
- package/node-mssql/driver.cjs +9 -3
- package/node-mssql/driver.cjs.map +1 -1
- package/node-mssql/driver.d.cts +1 -0
- package/node-mssql/driver.d.ts +3 -2
- package/node-mssql/driver.js +9 -3
- package/node-mssql/driver.js.map +1 -1
- package/node-mssql/session.cjs +6 -4
- package/node-mssql/session.cjs.map +1 -1
- package/node-mssql/session.d.cts +4 -1
- package/node-mssql/session.d.ts +6 -3
- package/node-mssql/session.js +7 -5
- package/node-mssql/session.js.map +1 -1
- package/node-postgres/driver.cjs +15 -18
- package/node-postgres/driver.cjs.map +1 -1
- package/node-postgres/driver.d.cts +11 -6
- package/node-postgres/driver.d.ts +12 -7
- package/node-postgres/driver.js +15 -18
- package/node-postgres/driver.js.map +1 -1
- package/node-postgres/index.cjs +2 -2
- package/node-postgres/index.d.cts +3 -3
- package/node-postgres/index.d.ts +3 -3
- package/node-postgres/index.js +3 -3
- package/node-postgres/migrator.cjs.map +1 -1
- package/node-postgres/migrator.d.cts +1 -1
- package/node-postgres/migrator.d.ts +1 -1
- package/node-postgres/migrator.js.map +1 -1
- package/node-postgres/session.cjs +33 -126
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.d.cts +10 -30
- package/node-postgres/session.d.ts +11 -31
- package/node-postgres/session.js +35 -127
- package/node-postgres/session.js.map +1 -1
- package/node-sqlite/driver.cjs +1 -1
- package/node-sqlite/driver.d.ts +1 -1
- package/node-sqlite/driver.js +1 -1
- package/node-sqlite/session.cjs +4 -9
- package/node-sqlite/session.cjs.map +1 -1
- package/node-sqlite/session.d.cts +3 -4
- package/node-sqlite/session.d.ts +4 -5
- package/node-sqlite/session.js +4 -9
- package/node-sqlite/session.js.map +1 -1
- package/op-sqlite/driver.cjs +3 -2
- package/op-sqlite/driver.cjs.map +1 -1
- package/op-sqlite/driver.d.ts +1 -1
- package/op-sqlite/driver.js +3 -2
- package/op-sqlite/driver.js.map +1 -1
- package/op-sqlite/session.cjs +18 -16
- package/op-sqlite/session.cjs.map +1 -1
- package/op-sqlite/session.d.cts +10 -6
- package/op-sqlite/session.d.ts +11 -7
- package/op-sqlite/session.js +19 -17
- package/op-sqlite/session.js.map +1 -1
- package/operations.d.cts +3 -0
- package/operations.d.ts +3 -0
- package/package.json +4727 -4715
- package/pg-core/{utils/array.cjs → array.cjs} +1 -1
- package/pg-core/array.cjs.map +1 -0
- package/pg-core/{utils/array.d.cts → array.d.cts} +1 -1
- package/pg-core/{utils/array.d.ts → array.d.ts} +1 -1
- package/pg-core/{utils/array.js → array.js} +1 -1
- package/pg-core/array.js.map +1 -0
- package/pg-core/async/count.cjs +2 -9
- package/pg-core/async/count.cjs.map +1 -1
- package/pg-core/async/count.js +2 -9
- package/pg-core/async/count.js.map +1 -1
- package/pg-core/async/db.cjs +10 -27
- package/pg-core/async/db.cjs.map +1 -1
- package/pg-core/async/db.d.cts +5 -13
- package/pg-core/async/db.d.ts +8 -16
- package/pg-core/async/db.js +10 -27
- package/pg-core/async/db.js.map +1 -1
- package/pg-core/async/delete.cjs +8 -13
- package/pg-core/async/delete.cjs.map +1 -1
- package/pg-core/async/delete.js +8 -13
- package/pg-core/async/delete.js.map +1 -1
- package/pg-core/async/insert.cjs +7 -12
- package/pg-core/async/insert.cjs.map +1 -1
- package/pg-core/async/insert.js +7 -12
- package/pg-core/async/insert.js.map +1 -1
- package/pg-core/async/query.cjs +8 -14
- package/pg-core/async/query.cjs.map +1 -1
- package/pg-core/async/query.js +8 -14
- package/pg-core/async/query.js.map +1 -1
- package/pg-core/async/refresh-materialized-view.cjs +1 -9
- package/pg-core/async/refresh-materialized-view.cjs.map +1 -1
- package/pg-core/async/refresh-materialized-view.js +1 -9
- package/pg-core/async/refresh-materialized-view.js.map +1 -1
- package/pg-core/async/select.cjs +4 -13
- package/pg-core/async/select.cjs.map +1 -1
- package/pg-core/async/select.js +4 -13
- package/pg-core/async/select.js.map +1 -1
- package/pg-core/async/session.cjs +46 -22
- package/pg-core/async/session.cjs.map +1 -1
- package/pg-core/async/session.d.cts +25 -31
- package/pg-core/async/session.d.ts +26 -32
- package/pg-core/async/session.js +47 -23
- package/pg-core/async/session.js.map +1 -1
- package/pg-core/async/update.cjs +11 -15
- package/pg-core/async/update.cjs.map +1 -1
- package/pg-core/async/update.js +11 -15
- package/pg-core/async/update.js.map +1 -1
- package/pg-core/codecs.cjs +156 -0
- package/pg-core/codecs.cjs.map +1 -0
- package/pg-core/codecs.d.cts +27 -0
- package/pg-core/codecs.d.ts +27 -0
- package/pg-core/codecs.js +148 -0
- package/pg-core/codecs.js.map +1 -0
- package/pg-core/columns/bigint.cjs +10 -9
- package/pg-core/columns/bigint.cjs.map +1 -1
- package/pg-core/columns/bigint.d.cts +2 -3
- package/pg-core/columns/bigint.d.ts +2 -3
- package/pg-core/columns/bigint.js +10 -9
- package/pg-core/columns/bigint.js.map +1 -1
- package/pg-core/columns/bigserial.cjs +6 -6
- package/pg-core/columns/bigserial.cjs.map +1 -1
- package/pg-core/columns/bigserial.d.cts +1 -2
- package/pg-core/columns/bigserial.d.ts +1 -2
- package/pg-core/columns/bigserial.js +6 -6
- package/pg-core/columns/bigserial.js.map +1 -1
- package/pg-core/columns/boolean.cjs +2 -0
- package/pg-core/columns/boolean.cjs.map +1 -1
- package/pg-core/columns/boolean.js +2 -0
- package/pg-core/columns/boolean.js.map +1 -1
- package/pg-core/columns/bytea.cjs +2 -8
- package/pg-core/columns/bytea.cjs.map +1 -1
- package/pg-core/columns/bytea.d.cts +0 -1
- package/pg-core/columns/bytea.d.ts +0 -1
- package/pg-core/columns/bytea.js +2 -8
- package/pg-core/columns/bytea.js.map +1 -1
- package/pg-core/columns/char.cjs +2 -0
- package/pg-core/columns/char.cjs.map +1 -1
- package/pg-core/columns/char.js +2 -0
- package/pg-core/columns/char.js.map +1 -1
- package/pg-core/columns/cidr.cjs +2 -0
- package/pg-core/columns/cidr.cjs.map +1 -1
- package/pg-core/columns/cidr.js +2 -0
- package/pg-core/columns/cidr.js.map +1 -1
- package/pg-core/columns/common.cjs +11 -9
- package/pg-core/columns/common.cjs.map +1 -1
- package/pg-core/columns/common.d.cts +34 -39
- package/pg-core/columns/common.d.ts +34 -39
- package/pg-core/columns/common.js +11 -9
- package/pg-core/columns/common.js.map +1 -1
- package/pg-core/columns/custom.cjs +16 -46
- package/pg-core/columns/custom.cjs.map +1 -1
- package/pg-core/columns/custom.d.cts +17 -8
- package/pg-core/columns/custom.d.ts +17 -8
- package/pg-core/columns/custom.js +16 -46
- package/pg-core/columns/custom.js.map +1 -1
- package/pg-core/columns/date.cjs +11 -12
- package/pg-core/columns/date.cjs.map +1 -1
- package/pg-core/columns/date.d.cts +3 -4
- package/pg-core/columns/date.d.ts +3 -4
- package/pg-core/columns/date.js +11 -12
- package/pg-core/columns/date.js.map +1 -1
- package/pg-core/columns/double-precision.cjs +2 -4
- package/pg-core/columns/double-precision.cjs.map +1 -1
- package/pg-core/columns/double-precision.d.cts +0 -1
- package/pg-core/columns/double-precision.d.ts +0 -1
- package/pg-core/columns/double-precision.js +2 -4
- package/pg-core/columns/double-precision.js.map +1 -1
- package/pg-core/columns/enum.cjs +4 -0
- package/pg-core/columns/enum.cjs.map +1 -1
- package/pg-core/columns/enum.js +4 -0
- package/pg-core/columns/enum.js.map +1 -1
- package/pg-core/columns/index.d.cts +2 -2
- package/pg-core/columns/index.d.ts +2 -2
- package/pg-core/columns/inet.cjs +2 -0
- package/pg-core/columns/inet.cjs.map +1 -1
- package/pg-core/columns/inet.js +2 -0
- package/pg-core/columns/inet.js.map +1 -1
- package/pg-core/columns/integer.cjs +2 -4
- package/pg-core/columns/integer.cjs.map +1 -1
- package/pg-core/columns/integer.d.cts +0 -1
- package/pg-core/columns/integer.d.ts +0 -1
- package/pg-core/columns/integer.js +2 -4
- package/pg-core/columns/integer.js.map +1 -1
- package/pg-core/columns/interval.cjs +2 -0
- package/pg-core/columns/interval.cjs.map +1 -1
- package/pg-core/columns/interval.js +2 -0
- package/pg-core/columns/interval.js.map +1 -1
- package/pg-core/columns/json.cjs +2 -11
- package/pg-core/columns/json.cjs.map +1 -1
- package/pg-core/columns/json.d.cts +0 -2
- package/pg-core/columns/json.d.ts +0 -2
- package/pg-core/columns/json.js +2 -11
- package/pg-core/columns/json.js.map +1 -1
- package/pg-core/columns/jsonb.cjs +2 -11
- package/pg-core/columns/jsonb.cjs.map +1 -1
- package/pg-core/columns/jsonb.d.cts +0 -2
- package/pg-core/columns/jsonb.d.ts +0 -2
- package/pg-core/columns/jsonb.js +2 -11
- package/pg-core/columns/jsonb.js.map +1 -1
- package/pg-core/columns/line.cjs +12 -8
- package/pg-core/columns/line.cjs.map +1 -1
- package/pg-core/columns/line.d.cts +5 -5
- package/pg-core/columns/line.d.ts +5 -5
- package/pg-core/columns/line.js +12 -8
- package/pg-core/columns/line.js.map +1 -1
- package/pg-core/columns/macaddr.cjs +2 -0
- package/pg-core/columns/macaddr.cjs.map +1 -1
- package/pg-core/columns/macaddr.js +2 -0
- package/pg-core/columns/macaddr.js.map +1 -1
- package/pg-core/columns/macaddr8.cjs +2 -0
- package/pg-core/columns/macaddr8.cjs.map +1 -1
- package/pg-core/columns/macaddr8.js +2 -0
- package/pg-core/columns/macaddr8.js.map +1 -1
- package/pg-core/columns/numeric.cjs +12 -15
- package/pg-core/columns/numeric.cjs.map +1 -1
- package/pg-core/columns/numeric.d.cts +4 -5
- package/pg-core/columns/numeric.d.ts +4 -5
- package/pg-core/columns/numeric.js +12 -15
- package/pg-core/columns/numeric.js.map +1 -1
- package/pg-core/columns/point.cjs +19 -21
- package/pg-core/columns/point.cjs.map +1 -1
- package/pg-core/columns/point.d.cts +5 -11
- package/pg-core/columns/point.d.ts +5 -11
- package/pg-core/columns/point.js +19 -21
- package/pg-core/columns/point.js.map +1 -1
- package/pg-core/columns/postgis_extension/geometry.cjs +12 -9
- package/pg-core/columns/postgis_extension/geometry.cjs.map +1 -1
- package/pg-core/columns/postgis_extension/geometry.d.cts +5 -5
- package/pg-core/columns/postgis_extension/geometry.d.ts +5 -5
- package/pg-core/columns/postgis_extension/geometry.js +12 -9
- package/pg-core/columns/postgis_extension/geometry.js.map +1 -1
- package/pg-core/columns/real.cjs +2 -4
- package/pg-core/columns/real.cjs.map +1 -1
- package/pg-core/columns/real.d.cts +0 -1
- package/pg-core/columns/real.d.ts +0 -1
- package/pg-core/columns/real.js +2 -4
- package/pg-core/columns/real.js.map +1 -1
- package/pg-core/columns/serial.cjs +2 -0
- package/pg-core/columns/serial.cjs.map +1 -1
- package/pg-core/columns/serial.js +2 -0
- package/pg-core/columns/serial.js.map +1 -1
- package/pg-core/columns/smallint.cjs +2 -4
- package/pg-core/columns/smallint.cjs.map +1 -1
- package/pg-core/columns/smallint.d.cts +0 -1
- package/pg-core/columns/smallint.d.ts +0 -1
- package/pg-core/columns/smallint.js +2 -4
- package/pg-core/columns/smallint.js.map +1 -1
- package/pg-core/columns/smallserial.cjs +2 -0
- package/pg-core/columns/smallserial.cjs.map +1 -1
- package/pg-core/columns/smallserial.js +2 -0
- package/pg-core/columns/smallserial.js.map +1 -1
- package/pg-core/columns/text.cjs +2 -0
- package/pg-core/columns/text.cjs.map +1 -1
- package/pg-core/columns/text.js +2 -0
- package/pg-core/columns/text.js.map +1 -1
- package/pg-core/columns/time.cjs +2 -0
- package/pg-core/columns/time.cjs.map +1 -1
- package/pg-core/columns/time.js +2 -0
- package/pg-core/columns/time.js.map +1 -1
- package/pg-core/columns/timestamp.cjs +13 -14
- package/pg-core/columns/timestamp.cjs.map +1 -1
- package/pg-core/columns/timestamp.d.cts +3 -4
- package/pg-core/columns/timestamp.d.ts +3 -4
- package/pg-core/columns/timestamp.js +13 -14
- package/pg-core/columns/timestamp.js.map +1 -1
- package/pg-core/columns/uuid.cjs +2 -0
- package/pg-core/columns/uuid.cjs.map +1 -1
- package/pg-core/columns/uuid.js +2 -0
- package/pg-core/columns/uuid.js.map +1 -1
- package/pg-core/columns/varchar.cjs +2 -0
- package/pg-core/columns/varchar.cjs.map +1 -1
- package/pg-core/columns/varchar.js +2 -0
- package/pg-core/columns/varchar.js.map +1 -1
- package/pg-core/columns/vector_extension/bit.cjs +2 -0
- package/pg-core/columns/vector_extension/bit.cjs.map +1 -1
- package/pg-core/columns/vector_extension/bit.js +2 -0
- package/pg-core/columns/vector_extension/bit.js.map +1 -1
- package/pg-core/columns/vector_extension/halfvec.cjs +6 -4
- package/pg-core/columns/vector_extension/halfvec.cjs.map +1 -1
- package/pg-core/columns/vector_extension/halfvec.d.cts +2 -2
- package/pg-core/columns/vector_extension/halfvec.d.ts +2 -2
- package/pg-core/columns/vector_extension/halfvec.js +6 -4
- package/pg-core/columns/vector_extension/halfvec.js.map +1 -1
- package/pg-core/columns/vector_extension/sparsevec.cjs +2 -0
- package/pg-core/columns/vector_extension/sparsevec.cjs.map +1 -1
- package/pg-core/columns/vector_extension/sparsevec.js +2 -0
- package/pg-core/columns/vector_extension/sparsevec.js.map +1 -1
- package/pg-core/columns/vector_extension/vector.cjs +6 -4
- package/pg-core/columns/vector_extension/vector.cjs.map +1 -1
- package/pg-core/columns/vector_extension/vector.d.cts +2 -2
- package/pg-core/columns/vector_extension/vector.d.ts +2 -2
- package/pg-core/columns/vector_extension/vector.js +6 -4
- package/pg-core/columns/vector_extension/vector.js.map +1 -1
- package/pg-core/dialect.cjs +52 -217
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.d.cts +19 -30
- package/pg-core/dialect.d.ts +20 -31
- package/pg-core/dialect.js +57 -221
- package/pg-core/dialect.js.map +1 -1
- package/pg-core/effect/count.cjs +1 -1
- package/pg-core/effect/count.cjs.map +1 -1
- package/pg-core/effect/count.d.cts +2 -2
- package/pg-core/effect/count.d.ts +2 -2
- package/pg-core/effect/count.js +1 -1
- package/pg-core/effect/count.js.map +1 -1
- package/pg-core/effect/db.cjs +14 -20
- package/pg-core/effect/db.cjs.map +1 -1
- package/pg-core/effect/db.d.cts +7 -11
- package/pg-core/effect/db.d.ts +9 -13
- package/pg-core/effect/db.js +14 -20
- package/pg-core/effect/db.js.map +1 -1
- package/pg-core/effect/delete.cjs +8 -6
- package/pg-core/effect/delete.cjs.map +1 -1
- package/pg-core/effect/delete.d.cts +1 -1
- package/pg-core/effect/delete.d.ts +1 -1
- package/pg-core/effect/delete.js +8 -6
- package/pg-core/effect/delete.js.map +1 -1
- package/pg-core/effect/index.cjs +3 -3
- package/pg-core/effect/index.js +3 -3
- package/pg-core/effect/insert.cjs +7 -5
- package/pg-core/effect/insert.cjs.map +1 -1
- package/pg-core/effect/insert.d.cts +1 -1
- package/pg-core/effect/insert.d.ts +1 -1
- package/pg-core/effect/insert.js +7 -5
- package/pg-core/effect/insert.js.map +1 -1
- package/pg-core/effect/query.cjs +7 -6
- package/pg-core/effect/query.cjs.map +1 -1
- package/pg-core/effect/query.d.cts +1 -1
- package/pg-core/effect/query.d.ts +1 -1
- package/pg-core/effect/query.js +7 -6
- package/pg-core/effect/query.js.map +1 -1
- package/pg-core/effect/refresh-materialized-view.cjs +1 -2
- package/pg-core/effect/refresh-materialized-view.cjs.map +1 -1
- package/pg-core/effect/refresh-materialized-view.d.cts +1 -1
- package/pg-core/effect/refresh-materialized-view.d.ts +1 -1
- package/pg-core/effect/refresh-materialized-view.js +1 -2
- package/pg-core/effect/refresh-materialized-view.js.map +1 -1
- package/pg-core/effect/select.cjs +3 -5
- package/pg-core/effect/select.cjs.map +1 -1
- package/pg-core/effect/select.d.cts +1 -1
- package/pg-core/effect/select.d.ts +1 -1
- package/pg-core/effect/select.js +3 -5
- package/pg-core/effect/select.js.map +1 -1
- package/pg-core/effect/session.cjs +30 -19
- package/pg-core/effect/session.cjs.map +1 -1
- package/pg-core/effect/session.d.cts +24 -28
- package/pg-core/effect/session.d.ts +25 -29
- package/pg-core/effect/session.js +31 -20
- package/pg-core/effect/session.js.map +1 -1
- package/pg-core/effect/update.cjs +8 -8
- package/pg-core/effect/update.cjs.map +1 -1
- package/pg-core/effect/update.d.cts +1 -1
- package/pg-core/effect/update.d.ts +1 -1
- package/pg-core/effect/update.js +8 -8
- package/pg-core/effect/update.js.map +1 -1
- package/pg-core/index.cjs +16 -16
- package/pg-core/index.d.cts +4 -4
- package/pg-core/index.d.ts +4 -4
- package/pg-core/index.js +13 -13
- package/pg-core/query-builders/delete.cjs +1 -1
- package/pg-core/query-builders/delete.cjs.map +1 -1
- package/pg-core/query-builders/delete.js +1 -1
- package/pg-core/query-builders/delete.js.map +1 -1
- package/pg-core/query-builders/index.cjs +1 -1
- package/pg-core/query-builders/index.js +1 -1
- package/pg-core/query-builders/insert.cjs +1 -1
- package/pg-core/query-builders/insert.cjs.map +1 -1
- package/pg-core/query-builders/insert.js +1 -1
- package/pg-core/query-builders/insert.js.map +1 -1
- package/pg-core/query-builders/query.cjs +0 -1
- package/pg-core/query-builders/query.cjs.map +1 -1
- package/pg-core/query-builders/query.d.cts +2 -1
- package/pg-core/query-builders/query.d.ts +2 -1
- package/pg-core/query-builders/query.js +0 -1
- package/pg-core/query-builders/query.js.map +1 -1
- package/pg-core/query-builders/raw.cjs +0 -4
- package/pg-core/query-builders/raw.cjs.map +1 -1
- package/pg-core/query-builders/raw.js +0 -4
- package/pg-core/query-builders/raw.js.map +1 -1
- package/pg-core/query-builders/update.cjs +1 -1
- package/pg-core/query-builders/update.cjs.map +1 -1
- package/pg-core/query-builders/update.js +1 -1
- package/pg-core/query-builders/update.js.map +1 -1
- package/pg-core/schema.cjs +1 -1
- package/pg-core/schema.js +1 -1
- package/pg-core/session.cjs +3 -5
- package/pg-core/session.cjs.map +1 -1
- package/pg-core/session.d.cts +4 -7
- package/pg-core/session.d.ts +4 -7
- package/pg-core/session.js +3 -5
- package/pg-core/session.js.map +1 -1
- package/pg-core/table.cjs +1 -1
- package/pg-core/table.cjs.map +1 -1
- package/pg-core/table.js +1 -1
- package/pg-core/table.js.map +1 -1
- package/pg-core/utils.cjs +2 -2
- package/pg-core/utils.cjs.map +1 -1
- package/pg-core/utils.d.cts +7 -1
- package/pg-core/utils.d.ts +7 -1
- package/pg-core/utils.js +2 -2
- package/pg-core/utils.js.map +1 -1
- package/pg-core/view.cjs +1 -1
- package/pg-core/view.js +1 -1
- package/pg-proxy/driver.cjs +10 -15
- package/pg-proxy/driver.cjs.map +1 -1
- package/pg-proxy/driver.d.cts +6 -3
- package/pg-proxy/driver.d.ts +7 -4
- package/pg-proxy/driver.js +10 -14
- package/pg-proxy/driver.js.map +1 -1
- package/pg-proxy/index.cjs +0 -2
- package/pg-proxy/index.d.cts +2 -2
- package/pg-proxy/index.d.ts +2 -2
- package/pg-proxy/index.js +2 -2
- package/pg-proxy/migrator.cjs.map +1 -1
- package/pg-proxy/migrator.d.cts +1 -1
- package/pg-proxy/migrator.d.ts +1 -1
- package/pg-proxy/migrator.js.map +1 -1
- package/pg-proxy/session.cjs +8 -84
- package/pg-proxy/session.cjs.map +1 -1
- package/pg-proxy/session.d.cts +9 -32
- package/pg-proxy/session.d.ts +10 -33
- package/pg-proxy/session.js +10 -84
- package/pg-proxy/session.js.map +1 -1
- package/pglite/driver.cjs +71 -33
- package/pglite/driver.cjs.map +1 -1
- package/pglite/driver.d.cts +12 -17
- package/pglite/driver.d.ts +14 -19
- package/pglite/driver.js +71 -32
- package/pglite/driver.js.map +1 -1
- package/pglite/index.cjs +2 -3
- package/pglite/index.d.cts +3 -3
- package/pglite/index.d.ts +3 -3
- package/pglite/index.js +3 -3
- package/pglite/migrator.cjs.map +1 -1
- package/pglite/migrator.d.cts +1 -1
- package/pglite/migrator.d.ts +1 -1
- package/pglite/migrator.js.map +1 -1
- package/pglite/session.cjs +25 -86
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.d.cts +9 -30
- package/pglite/session.d.ts +11 -32
- package/pglite/session.js +27 -87
- package/pglite/session.js.map +1 -1
- package/planetscale-serverless/driver.cjs +3 -2
- package/planetscale-serverless/driver.cjs.map +1 -1
- package/planetscale-serverless/driver.d.cts +1 -0
- package/planetscale-serverless/driver.d.ts +1 -0
- package/planetscale-serverless/driver.js +3 -2
- package/planetscale-serverless/driver.js.map +1 -1
- package/planetscale-serverless/session.cjs +27 -20
- package/planetscale-serverless/session.cjs.map +1 -1
- package/planetscale-serverless/session.d.cts +12 -6
- package/planetscale-serverless/session.d.ts +14 -8
- package/planetscale-serverless/session.js +28 -21
- package/planetscale-serverless/session.js.map +1 -1
- package/postgres-js/driver.cjs +124 -19
- package/postgres-js/driver.cjs.map +1 -1
- package/postgres-js/driver.d.cts +10 -6
- package/postgres-js/driver.d.ts +11 -7
- package/postgres-js/driver.js +124 -19
- package/postgres-js/driver.js.map +1 -1
- package/postgres-js/index.cjs +2 -2
- package/postgres-js/index.d.cts +3 -3
- package/postgres-js/index.d.ts +3 -3
- package/postgres-js/index.js +3 -3
- package/postgres-js/migrator.cjs.map +1 -1
- package/postgres-js/migrator.d.cts +1 -1
- package/postgres-js/migrator.d.ts +1 -1
- package/postgres-js/migrator.js.map +1 -1
- package/postgres-js/session.cjs +17 -112
- package/postgres-js/session.cjs.map +1 -1
- package/postgres-js/session.d.cts +10 -31
- package/postgres-js/session.d.ts +11 -32
- package/postgres-js/session.js +18 -112
- package/postgres-js/session.js.map +1 -1
- package/prisma/mysql/driver.cjs +1 -1
- package/prisma/mysql/driver.js +1 -1
- package/prisma/mysql/session.cjs +2 -1
- package/prisma/mysql/session.cjs.map +1 -1
- package/prisma/mysql/session.d.cts +1 -0
- package/prisma/mysql/session.d.ts +2 -1
- package/prisma/mysql/session.js +2 -1
- package/prisma/mysql/session.js.map +1 -1
- package/prisma/pg/driver.cjs +9 -3
- package/prisma/pg/driver.cjs.map +1 -1
- package/prisma/pg/driver.d.cts +7 -3
- package/prisma/pg/driver.d.ts +7 -3
- package/prisma/pg/driver.js +9 -4
- package/prisma/pg/driver.js.map +1 -1
- package/prisma/pg/index.cjs +2 -2
- package/prisma/pg/index.d.cts +3 -3
- package/prisma/pg/index.d.ts +3 -3
- package/prisma/pg/index.js +3 -3
- package/prisma/pg/session.cjs +1 -25
- package/prisma/pg/session.cjs.map +1 -1
- package/prisma/pg/session.d.cts +3 -15
- package/prisma/pg/session.d.ts +3 -15
- package/prisma/pg/session.js +2 -25
- package/prisma/pg/session.js.map +1 -1
- package/prisma/sqlite/session.cjs +0 -3
- package/prisma/sqlite/session.cjs.map +1 -1
- package/prisma/sqlite/session.d.cts +0 -1
- package/prisma/sqlite/session.d.ts +1 -2
- package/prisma/sqlite/session.js +0 -3
- package/prisma/sqlite/session.js.map +1 -1
- package/relations.cjs +85 -24
- package/relations.cjs.map +1 -1
- package/relations.d.cts +41 -16
- package/relations.d.ts +41 -16
- package/relations.js +84 -25
- package/relations.js.map +1 -1
- package/row-mappers/index.cjs +1 -1
- package/row-mappers/index.cjs.map +1 -1
- package/row-mappers/index.js +1 -1
- package/row-mappers/index.js.map +1 -1
- package/selection-proxy.cjs +1 -1
- package/selection-proxy.js +1 -1
- package/singlestore/driver.cjs +4 -2
- package/singlestore/driver.cjs.map +1 -1
- package/singlestore/driver.d.cts +2 -1
- package/singlestore/driver.d.ts +4 -3
- package/singlestore/driver.js +4 -2
- package/singlestore/driver.js.map +1 -1
- package/singlestore/session.cjs +17 -7
- package/singlestore/session.cjs.map +1 -1
- package/singlestore/session.d.cts +8 -4
- package/singlestore/session.d.ts +10 -6
- package/singlestore/session.js +18 -8
- package/singlestore/session.js.map +1 -1
- package/singlestore-core/columns/bigint.cjs +4 -4
- package/singlestore-core/columns/bigint.cjs.map +1 -1
- package/singlestore-core/columns/bigint.d.cts +2 -2
- package/singlestore-core/columns/bigint.d.ts +2 -2
- package/singlestore-core/columns/bigint.js +4 -4
- package/singlestore-core/columns/bigint.js.map +1 -1
- package/singlestore-core/columns/binary.cjs +2 -2
- package/singlestore-core/columns/binary.cjs.map +1 -1
- package/singlestore-core/columns/binary.d.cts +1 -1
- package/singlestore-core/columns/binary.d.ts +1 -1
- package/singlestore-core/columns/binary.js +2 -2
- package/singlestore-core/columns/binary.js.map +1 -1
- package/singlestore-core/columns/boolean.cjs +2 -2
- package/singlestore-core/columns/boolean.cjs.map +1 -1
- package/singlestore-core/columns/boolean.d.cts +1 -1
- package/singlestore-core/columns/boolean.d.ts +1 -1
- package/singlestore-core/columns/boolean.js +2 -2
- package/singlestore-core/columns/boolean.js.map +1 -1
- package/singlestore-core/columns/custom.cjs +4 -4
- package/singlestore-core/columns/custom.cjs.map +1 -1
- package/singlestore-core/columns/custom.d.cts +2 -2
- package/singlestore-core/columns/custom.d.ts +2 -2
- package/singlestore-core/columns/custom.js +4 -4
- package/singlestore-core/columns/custom.js.map +1 -1
- package/singlestore-core/columns/date.cjs +2 -2
- package/singlestore-core/columns/date.cjs.map +1 -1
- package/singlestore-core/columns/date.d.cts +1 -1
- package/singlestore-core/columns/date.d.ts +1 -1
- package/singlestore-core/columns/date.js +2 -2
- package/singlestore-core/columns/date.js.map +1 -1
- package/singlestore-core/columns/datetime.cjs +6 -6
- package/singlestore-core/columns/datetime.cjs.map +1 -1
- package/singlestore-core/columns/datetime.d.cts +3 -3
- package/singlestore-core/columns/datetime.d.ts +3 -3
- package/singlestore-core/columns/datetime.js +6 -6
- package/singlestore-core/columns/datetime.js.map +1 -1
- package/singlestore-core/columns/decimal.cjs +4 -4
- package/singlestore-core/columns/decimal.cjs.map +1 -1
- package/singlestore-core/columns/decimal.d.cts +2 -2
- package/singlestore-core/columns/decimal.d.ts +2 -2
- package/singlestore-core/columns/decimal.js +4 -4
- package/singlestore-core/columns/decimal.js.map +1 -1
- package/singlestore-core/columns/float.cjs +2 -2
- package/singlestore-core/columns/float.cjs.map +1 -1
- package/singlestore-core/columns/float.d.cts +1 -1
- package/singlestore-core/columns/float.d.ts +1 -1
- package/singlestore-core/columns/float.js +2 -2
- package/singlestore-core/columns/float.js.map +1 -1
- package/singlestore-core/columns/int.cjs +2 -2
- package/singlestore-core/columns/int.cjs.map +1 -1
- package/singlestore-core/columns/int.d.cts +1 -1
- package/singlestore-core/columns/int.d.ts +1 -1
- package/singlestore-core/columns/int.js +2 -2
- package/singlestore-core/columns/int.js.map +1 -1
- package/singlestore-core/columns/json.cjs +2 -2
- package/singlestore-core/columns/json.cjs.map +1 -1
- package/singlestore-core/columns/json.d.cts +1 -1
- package/singlestore-core/columns/json.d.ts +1 -1
- package/singlestore-core/columns/json.js +2 -2
- package/singlestore-core/columns/json.js.map +1 -1
- package/singlestore-core/columns/mediumint.cjs +2 -2
- package/singlestore-core/columns/mediumint.cjs.map +1 -1
- package/singlestore-core/columns/mediumint.d.cts +1 -1
- package/singlestore-core/columns/mediumint.d.ts +1 -1
- package/singlestore-core/columns/mediumint.js +2 -2
- package/singlestore-core/columns/mediumint.js.map +1 -1
- package/singlestore-core/columns/serial.cjs +2 -2
- package/singlestore-core/columns/serial.cjs.map +1 -1
- package/singlestore-core/columns/serial.d.cts +1 -1
- package/singlestore-core/columns/serial.d.ts +1 -1
- package/singlestore-core/columns/serial.js +2 -2
- package/singlestore-core/columns/serial.js.map +1 -1
- package/singlestore-core/columns/smallint.cjs +2 -2
- package/singlestore-core/columns/smallint.cjs.map +1 -1
- package/singlestore-core/columns/smallint.d.cts +1 -1
- package/singlestore-core/columns/smallint.d.ts +1 -1
- package/singlestore-core/columns/smallint.js +2 -2
- package/singlestore-core/columns/smallint.js.map +1 -1
- package/singlestore-core/columns/timestamp.cjs +6 -6
- package/singlestore-core/columns/timestamp.cjs.map +1 -1
- package/singlestore-core/columns/timestamp.d.cts +3 -3
- package/singlestore-core/columns/timestamp.d.ts +3 -3
- package/singlestore-core/columns/timestamp.js +6 -6
- package/singlestore-core/columns/timestamp.js.map +1 -1
- package/singlestore-core/columns/tinyint.cjs +2 -2
- package/singlestore-core/columns/tinyint.cjs.map +1 -1
- package/singlestore-core/columns/tinyint.d.cts +1 -1
- package/singlestore-core/columns/tinyint.d.ts +1 -1
- package/singlestore-core/columns/tinyint.js +2 -2
- package/singlestore-core/columns/tinyint.js.map +1 -1
- package/singlestore-core/columns/varbinary.cjs +2 -2
- package/singlestore-core/columns/varbinary.cjs.map +1 -1
- package/singlestore-core/columns/varbinary.d.cts +1 -1
- package/singlestore-core/columns/varbinary.d.ts +1 -1
- package/singlestore-core/columns/varbinary.js +2 -2
- package/singlestore-core/columns/varbinary.js.map +1 -1
- package/singlestore-core/columns/vector.cjs +8 -8
- package/singlestore-core/columns/vector.cjs.map +1 -1
- package/singlestore-core/columns/vector.d.cts +4 -4
- package/singlestore-core/columns/vector.d.ts +4 -4
- package/singlestore-core/columns/vector.js +8 -8
- package/singlestore-core/columns/vector.js.map +1 -1
- package/singlestore-core/columns/year.cjs +2 -2
- package/singlestore-core/columns/year.cjs.map +1 -1
- package/singlestore-core/columns/year.d.cts +1 -1
- package/singlestore-core/columns/year.d.ts +1 -1
- package/singlestore-core/columns/year.js +2 -2
- package/singlestore-core/columns/year.js.map +1 -1
- package/singlestore-core/db.d.ts +2 -2
- package/singlestore-core/dialect.cjs +2 -2
- package/singlestore-core/dialect.d.ts +1 -1
- package/singlestore-core/dialect.js +2 -2
- package/singlestore-core/query-builders/delete.d.ts +1 -1
- package/singlestore-core/query-builders/insert.d.ts +1 -1
- package/singlestore-core/query-builders/query.cjs +13 -5
- package/singlestore-core/query-builders/query.cjs.map +1 -1
- package/singlestore-core/query-builders/query.d.ts +1 -1
- package/singlestore-core/query-builders/query.js +13 -5
- package/singlestore-core/query-builders/query.js.map +1 -1
- package/singlestore-core/query-builders/select.d.ts +1 -1
- package/singlestore-core/query-builders/update.d.ts +1 -1
- package/singlestore-core/session.cjs.map +1 -1
- package/singlestore-core/session.d.cts +2 -2
- package/singlestore-core/session.d.ts +2 -2
- package/singlestore-core/session.js.map +1 -1
- package/singlestore-core/table.cjs +1 -1
- package/singlestore-core/table.cjs.map +1 -1
- package/singlestore-core/table.js +1 -1
- package/singlestore-core/table.js.map +1 -1
- package/singlestore-proxy/driver.cjs +5 -2
- package/singlestore-proxy/driver.cjs.map +1 -1
- package/singlestore-proxy/driver.js +5 -2
- package/singlestore-proxy/driver.js.map +1 -1
- package/singlestore-proxy/session.cjs +11 -6
- package/singlestore-proxy/session.cjs.map +1 -1
- package/singlestore-proxy/session.d.cts +9 -4
- package/singlestore-proxy/session.d.ts +10 -5
- package/singlestore-proxy/session.js +12 -7
- package/singlestore-proxy/session.js.map +1 -1
- package/sql/index.cjs +1 -0
- package/sql/index.d.cts +2 -2
- package/sql/index.d.ts +2 -2
- package/sql/index.js +2 -2
- package/sql/sql.cjs +32 -11
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.d.cts +15 -5
- package/sql/sql.d.ts +15 -5
- package/sql/sql.js +32 -12
- package/sql/sql.js.map +1 -1
- package/sql-js/driver.cjs +5 -2
- package/sql-js/driver.cjs.map +1 -1
- package/sql-js/driver.d.ts +1 -1
- package/sql-js/driver.js +5 -2
- package/sql-js/driver.js.map +1 -1
- package/sql-js/session.cjs +14 -14
- package/sql-js/session.cjs.map +1 -1
- package/sql-js/session.d.cts +10 -6
- package/sql-js/session.d.ts +10 -6
- package/sql-js/session.js +15 -15
- package/sql-js/session.js.map +1 -1
- package/sqlite-cloud/driver.cjs +3 -2
- package/sqlite-cloud/driver.cjs.map +1 -1
- package/sqlite-cloud/driver.d.ts +1 -1
- package/sqlite-cloud/driver.js +3 -2
- package/sqlite-cloud/driver.js.map +1 -1
- package/sqlite-cloud/session.cjs +21 -20
- package/sqlite-cloud/session.cjs.map +1 -1
- package/sqlite-cloud/session.d.cts +9 -6
- package/sqlite-cloud/session.d.ts +10 -7
- package/sqlite-cloud/session.js +22 -21
- package/sqlite-cloud/session.js.map +1 -1
- package/sqlite-core/columns/blob.cjs +10 -10
- package/sqlite-core/columns/blob.cjs.map +1 -1
- package/sqlite-core/columns/blob.d.cts +5 -5
- package/sqlite-core/columns/blob.d.ts +5 -5
- package/sqlite-core/columns/blob.js +10 -10
- package/sqlite-core/columns/blob.js.map +1 -1
- package/sqlite-core/columns/custom.cjs +4 -4
- package/sqlite-core/columns/custom.cjs.map +1 -1
- package/sqlite-core/columns/custom.d.cts +2 -2
- package/sqlite-core/columns/custom.d.ts +2 -2
- package/sqlite-core/columns/custom.js +4 -4
- package/sqlite-core/columns/custom.js.map +1 -1
- package/sqlite-core/columns/integer.cjs +8 -8
- package/sqlite-core/columns/integer.cjs.map +1 -1
- package/sqlite-core/columns/integer.d.cts +4 -4
- package/sqlite-core/columns/integer.d.ts +4 -4
- package/sqlite-core/columns/integer.js +8 -8
- package/sqlite-core/columns/integer.js.map +1 -1
- package/sqlite-core/columns/numeric.cjs +4 -4
- package/sqlite-core/columns/numeric.cjs.map +1 -1
- package/sqlite-core/columns/numeric.d.cts +2 -2
- package/sqlite-core/columns/numeric.d.ts +2 -2
- package/sqlite-core/columns/numeric.js +4 -4
- package/sqlite-core/columns/numeric.js.map +1 -1
- package/sqlite-core/columns/text.cjs +4 -4
- package/sqlite-core/columns/text.cjs.map +1 -1
- package/sqlite-core/columns/text.d.cts +2 -2
- package/sqlite-core/columns/text.d.ts +2 -2
- package/sqlite-core/columns/text.js +4 -4
- package/sqlite-core/columns/text.js.map +1 -1
- package/sqlite-core/db.d.ts +1 -1
- package/sqlite-core/dialect.cjs +2 -2
- package/sqlite-core/dialect.d.ts +1 -1
- package/sqlite-core/dialect.js +2 -2
- package/sqlite-core/index.cjs +9 -9
- package/sqlite-core/index.js +9 -9
- package/sqlite-core/query-builders/_query.cjs +1 -1
- package/sqlite-core/query-builders/_query.cjs.map +1 -1
- package/sqlite-core/query-builders/_query.js +1 -1
- package/sqlite-core/query-builders/_query.js.map +1 -1
- package/sqlite-core/query-builders/delete.cjs +1 -1
- package/sqlite-core/query-builders/delete.cjs.map +1 -1
- package/sqlite-core/query-builders/delete.js +1 -1
- package/sqlite-core/query-builders/delete.js.map +1 -1
- package/sqlite-core/query-builders/index.cjs +1 -1
- package/sqlite-core/query-builders/index.js +1 -1
- package/sqlite-core/query-builders/insert.cjs +1 -1
- package/sqlite-core/query-builders/insert.cjs.map +1 -1
- package/sqlite-core/query-builders/insert.js +1 -1
- package/sqlite-core/query-builders/insert.js.map +1 -1
- package/sqlite-core/query-builders/query.cjs +13 -5
- package/sqlite-core/query-builders/query.cjs.map +1 -1
- package/sqlite-core/query-builders/query.d.ts +1 -1
- package/sqlite-core/query-builders/query.js +13 -5
- package/sqlite-core/query-builders/query.js.map +1 -1
- package/sqlite-core/query-builders/raw.cjs +0 -4
- package/sqlite-core/query-builders/raw.cjs.map +1 -1
- package/sqlite-core/query-builders/raw.js +0 -4
- package/sqlite-core/query-builders/raw.js.map +1 -1
- package/sqlite-core/query-builders/select.cjs +2 -2
- package/sqlite-core/query-builders/select.cjs.map +1 -1
- package/sqlite-core/query-builders/select.js +2 -2
- package/sqlite-core/query-builders/select.js.map +1 -1
- package/sqlite-core/query-builders/update.cjs +2 -2
- package/sqlite-core/query-builders/update.cjs.map +1 -1
- package/sqlite-core/query-builders/update.js +2 -2
- package/sqlite-core/query-builders/update.js.map +1 -1
- package/sqlite-core/session.cjs +8 -8
- package/sqlite-core/session.cjs.map +1 -1
- package/sqlite-core/session.d.cts +5 -5
- package/sqlite-core/session.d.ts +5 -5
- package/sqlite-core/session.js +8 -8
- package/sqlite-core/session.js.map +1 -1
- package/sqlite-core/table.cjs +1 -1
- package/sqlite-core/table.cjs.map +1 -1
- package/sqlite-core/table.js +1 -1
- package/sqlite-core/table.js.map +1 -1
- package/sqlite-core/utils.cjs +3 -3
- package/sqlite-core/utils.js +3 -3
- package/sqlite-proxy/driver.cjs +3 -2
- package/sqlite-proxy/driver.cjs.map +1 -1
- package/sqlite-proxy/driver.d.ts +1 -1
- package/sqlite-proxy/driver.js +3 -2
- package/sqlite-proxy/driver.js.map +1 -1
- package/sqlite-proxy/session.cjs +20 -17
- package/sqlite-proxy/session.cjs.map +1 -1
- package/sqlite-proxy/session.d.cts +11 -7
- package/sqlite-proxy/session.d.ts +12 -8
- package/sqlite-proxy/session.js +21 -18
- package/sqlite-proxy/session.js.map +1 -1
- package/table.d.cts +1 -1
- package/table.d.ts +1 -1
- package/tidb-serverless/driver.cjs +3 -2
- package/tidb-serverless/driver.cjs.map +1 -1
- package/tidb-serverless/driver.d.cts +1 -0
- package/tidb-serverless/driver.d.ts +1 -0
- package/tidb-serverless/driver.js +3 -2
- package/tidb-serverless/driver.js.map +1 -1
- package/tidb-serverless/session.cjs +25 -37
- package/tidb-serverless/session.cjs.map +1 -1
- package/tidb-serverless/session.d.cts +10 -4
- package/tidb-serverless/session.d.ts +12 -6
- package/tidb-serverless/session.js +26 -38
- package/tidb-serverless/session.js.map +1 -1
- package/tursodatabase/driver-core.cjs +3 -2
- package/tursodatabase/driver-core.cjs.map +1 -1
- package/tursodatabase/driver-core.d.ts +1 -1
- package/tursodatabase/driver-core.js +3 -2
- package/tursodatabase/driver-core.js.map +1 -1
- package/tursodatabase/session.cjs +20 -19
- package/tursodatabase/session.cjs.map +1 -1
- package/tursodatabase/session.d.cts +9 -6
- package/tursodatabase/session.d.ts +10 -7
- package/tursodatabase/session.js +21 -20
- package/tursodatabase/session.js.map +1 -1
- package/up-migrations/effect-pg.cjs +3 -3
- package/up-migrations/effect-pg.cjs.map +1 -1
- package/up-migrations/effect-pg.d.ts +1 -1
- package/up-migrations/effect-pg.js +3 -3
- package/up-migrations/effect-pg.js.map +1 -1
- package/up-migrations/pg.cjs +3 -8
- package/up-migrations/pg.cjs.map +1 -1
- package/up-migrations/pg.d.cts +1 -1
- package/up-migrations/pg.d.ts +2 -2
- package/up-migrations/pg.js +3 -8
- package/up-migrations/pg.js.map +1 -1
- package/up-migrations/sqlite.d.ts +2 -2
- package/utils.cjs +129 -7
- package/utils.cjs.map +1 -1
- package/utils.d.cts +10 -3
- package/utils.d.ts +10 -3
- package/utils.js +127 -8
- package/utils.js.map +1 -1
- package/vercel-postgres/driver.cjs +14 -32
- package/vercel-postgres/driver.cjs.map +1 -1
- package/vercel-postgres/driver.d.cts +12 -17
- package/vercel-postgres/driver.d.ts +13 -18
- package/vercel-postgres/driver.js +14 -31
- package/vercel-postgres/driver.js.map +1 -1
- package/vercel-postgres/index.cjs +2 -3
- package/vercel-postgres/index.d.cts +3 -3
- package/vercel-postgres/index.d.ts +3 -3
- package/vercel-postgres/index.js +3 -3
- package/vercel-postgres/migrator.cjs.map +1 -1
- package/vercel-postgres/migrator.d.cts +1 -1
- package/vercel-postgres/migrator.d.ts +1 -1
- package/vercel-postgres/migrator.js.map +1 -1
- package/vercel-postgres/session.cjs +32 -110
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.d.cts +9 -32
- package/vercel-postgres/session.d.ts +10 -33
- package/vercel-postgres/session.js +34 -111
- package/vercel-postgres/session.js.map +1 -1
- package/xata-http/driver.cjs +91 -31
- package/xata-http/driver.cjs.map +1 -1
- package/xata-http/driver.d.cts +10 -16
- package/xata-http/driver.d.ts +11 -17
- package/xata-http/driver.js +91 -30
- package/xata-http/driver.js.map +1 -1
- package/xata-http/index.cjs +2 -4
- package/xata-http/index.d.cts +3 -3
- package/xata-http/index.d.ts +3 -3
- package/xata-http/index.js +3 -3
- package/xata-http/migrator.cjs +1 -1
- package/xata-http/migrator.cjs.map +1 -1
- package/xata-http/migrator.d.cts +1 -1
- package/xata-http/migrator.d.ts +1 -1
- package/xata-http/migrator.js +1 -1
- package/xata-http/migrator.js.map +1 -1
- package/xata-http/session.cjs +24 -110
- package/xata-http/session.cjs.map +1 -1
- package/xata-http/session.d.cts +7 -33
- package/xata-http/session.d.ts +8 -34
- package/xata-http/session.js +26 -110
- package/xata-http/session.js.map +1 -1
- package/pg-core/query-builders/_query.cjs +0 -101
- package/pg-core/query-builders/_query.cjs.map +0 -1
- package/pg-core/query-builders/_query.d.cts +0 -55
- package/pg-core/query-builders/_query.d.ts +0 -55
- package/pg-core/query-builders/_query.js +0 -97
- package/pg-core/query-builders/_query.js.map +0 -1
- package/pg-core/utils/array.cjs.map +0 -1
- package/pg-core/utils/array.js.map +0 -1
- package/pg-core/utils/index.cjs +0 -6
- package/pg-core/utils/index.d.cts +0 -2
- package/pg-core/utils/index.d.ts +0 -2
- package/pg-core/utils/index.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"count.cjs","names":["PgCountBuilder","entityKind"],"sources":["../../../src/pg-core/effect/count.ts"],"sourcesContent":["import type * as Effect from 'effect/Effect';\nimport { applyEffectWrapper, type QueryEffectHKTBase } from '~/effect-core/query-effect.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { PgDialect } from '../dialect.ts';\nimport { PgCountBuilder } from '../query-builders/count.ts';\nimport type { PgTable } from '../table.ts';\nimport type { PgViewBase } from '../view-base.ts';\nimport type { PgEffectSession } from './session.ts';\n\nexport interface PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase>\n\textends PgCountBuilder, Effect.Effect<number, TEffectHKT['error'], TEffectHKT['context']>\n{}\n\nexport class PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase> extends PgCountBuilder {\n\tstatic override readonly [entityKind]: string = 'PgEffectCountBuilder';\n\n\tprotected session: PgEffectSession<TEffectHKT, any, any
|
|
1
|
+
{"version":3,"file":"count.cjs","names":["PgCountBuilder","entityKind"],"sources":["../../../src/pg-core/effect/count.ts"],"sourcesContent":["import type * as Effect from 'effect/Effect';\nimport { applyEffectWrapper, type QueryEffectHKTBase } from '~/effect-core/query-effect.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { PgDialect } from '../dialect.ts';\nimport { PgCountBuilder } from '../query-builders/count.ts';\nimport type { PgTable } from '../table.ts';\nimport type { PgViewBase } from '../view-base.ts';\nimport type { PgEffectSession } from './session.ts';\n\nexport interface PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase>\n\textends PgCountBuilder, Effect.Effect<number, TEffectHKT['error'], TEffectHKT['context']>\n{}\n\nexport class PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase> extends PgCountBuilder {\n\tstatic override readonly [entityKind]: string = 'PgEffectCountBuilder';\n\n\tprotected session: PgEffectSession<TEffectHKT, any, any>;\n\n\tconstructor(\n\t\t{ source, dialect, filters, session }: {\n\t\t\tsource: PgTable | PgViewBase | SQL | SQLWrapper;\n\t\t\tfilters?: SQL<unknown>;\n\t\t\tdialect: PgDialect;\n\t\t\tsession: PgEffectSession<TEffectHKT, any, any>;\n\t\t},\n\t) {\n\t\tsuper({ source, dialect, filters });\n\t\tthis.session = session;\n\t}\n\n\texecute(placeholderValues?: Record<string, unknown>) {\n\t\treturn this.session.prepareQuery<{\n\t\t\texecute: number;\n\t\t\tobjects: unknown;\n\t\t\tarrays: unknown;\n\t\t\traw: unknown;\n\t\t}>(\n\t\t\tthis.build(),\n\t\t\t'arrays',\n\t\t\tfalse,\n\t\t\t(rows) => {\n\t\t\t\tconst v = rows[0]?.[0];\n\t\t\t\tif (typeof v === 'number') return v;\n\t\t\t\treturn v ? Number(v) : 0;\n\t\t\t},\n\t\t).execute(placeholderValues);\n\t}\n}\n\napplyEffectWrapper(PgEffectCountBuilder);\n"],"mappings":";;;;;;;AAcA,IAAa,uBAAb,cAAsGA,oDAAe;CACpH,QAA0BC,0BAAsB;CAEhD,AAAU;CAEV,YACC,EAAE,QAAQ,SAAS,SAAS,WAM3B;AACD,QAAM;GAAE;GAAQ;GAAS;GAAS,CAAC;AACnC,OAAK,UAAU;;CAGhB,QAAQ,mBAA6C;AACpD,SAAO,KAAK,QAAQ,aAMnB,KAAK,OAAO,EACZ,UACA,QACC,SAAS;GACT,MAAM,IAAI,KAAK,KAAK;AACpB,OAAI,OAAO,MAAM,SAAU,QAAO;AAClC,UAAO,IAAI,OAAO,EAAE,GAAG;IAExB,CAAC,QAAQ,kBAAkB;;;sDAIX,qBAAqB"}
|
|
@@ -13,7 +13,7 @@ import { QueryEffectHKTBase } from "../../effect-core/query-effect.cjs";
|
|
|
13
13
|
interface PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase> extends PgCountBuilder, Effect.Effect<number, TEffectHKT['error'], TEffectHKT['context']> {}
|
|
14
14
|
declare class PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase> extends PgCountBuilder {
|
|
15
15
|
static readonly [entityKind]: string;
|
|
16
|
-
protected session: PgEffectSession<TEffectHKT, any, any
|
|
16
|
+
protected session: PgEffectSession<TEffectHKT, any, any>;
|
|
17
17
|
constructor({
|
|
18
18
|
source,
|
|
19
19
|
dialect,
|
|
@@ -23,7 +23,7 @@ declare class PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = Query
|
|
|
23
23
|
source: PgTable | PgViewBase | SQL | SQLWrapper;
|
|
24
24
|
filters?: SQL<unknown>;
|
|
25
25
|
dialect: PgDialect;
|
|
26
|
-
session: PgEffectSession<TEffectHKT, any, any
|
|
26
|
+
session: PgEffectSession<TEffectHKT, any, any>;
|
|
27
27
|
});
|
|
28
28
|
execute(placeholderValues?: Record<string, unknown>): __effect_core_query_effect_ts0.QueryEffectKind<TEffectHKT, number>;
|
|
29
29
|
}
|
|
@@ -13,7 +13,7 @@ import { QueryEffectHKTBase } from "../../effect-core/query-effect.js";
|
|
|
13
13
|
interface PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase> extends PgCountBuilder, Effect.Effect<number, TEffectHKT['error'], TEffectHKT['context']> {}
|
|
14
14
|
declare class PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase> extends PgCountBuilder {
|
|
15
15
|
static readonly [entityKind]: string;
|
|
16
|
-
protected session: PgEffectSession<TEffectHKT, any, any
|
|
16
|
+
protected session: PgEffectSession<TEffectHKT, any, any>;
|
|
17
17
|
constructor({
|
|
18
18
|
source,
|
|
19
19
|
dialect,
|
|
@@ -23,7 +23,7 @@ declare class PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = Query
|
|
|
23
23
|
source: PgTable | PgViewBase | SQL | SQLWrapper;
|
|
24
24
|
filters?: SQL<unknown>;
|
|
25
25
|
dialect: PgDialect;
|
|
26
|
-
session: PgEffectSession<TEffectHKT, any, any
|
|
26
|
+
session: PgEffectSession<TEffectHKT, any, any>;
|
|
27
27
|
});
|
|
28
28
|
execute(placeholderValues?: Record<string, unknown>): __effect_core_query_effect_ts0.QueryEffectKind<TEffectHKT, number>;
|
|
29
29
|
}
|
package/pg-core/effect/count.js
CHANGED
|
@@ -15,7 +15,7 @@ var PgEffectCountBuilder = class extends PgCountBuilder {
|
|
|
15
15
|
this.session = session;
|
|
16
16
|
}
|
|
17
17
|
execute(placeholderValues) {
|
|
18
|
-
return this.session.prepareQuery(this.build(),
|
|
18
|
+
return this.session.prepareQuery(this.build(), "arrays", false, (rows) => {
|
|
19
19
|
const v = rows[0]?.[0];
|
|
20
20
|
if (typeof v === "number") return v;
|
|
21
21
|
return v ? Number(v) : 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"count.js","names":[],"sources":["../../../src/pg-core/effect/count.ts"],"sourcesContent":["import type * as Effect from 'effect/Effect';\nimport { applyEffectWrapper, type QueryEffectHKTBase } from '~/effect-core/query-effect.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { PgDialect } from '../dialect.ts';\nimport { PgCountBuilder } from '../query-builders/count.ts';\nimport type { PgTable } from '../table.ts';\nimport type { PgViewBase } from '../view-base.ts';\nimport type { PgEffectSession } from './session.ts';\n\nexport interface PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase>\n\textends PgCountBuilder, Effect.Effect<number, TEffectHKT['error'], TEffectHKT['context']>\n{}\n\nexport class PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase> extends PgCountBuilder {\n\tstatic override readonly [entityKind]: string = 'PgEffectCountBuilder';\n\n\tprotected session: PgEffectSession<TEffectHKT, any, any
|
|
1
|
+
{"version":3,"file":"count.js","names":[],"sources":["../../../src/pg-core/effect/count.ts"],"sourcesContent":["import type * as Effect from 'effect/Effect';\nimport { applyEffectWrapper, type QueryEffectHKTBase } from '~/effect-core/query-effect.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { SQL, SQLWrapper } from '~/sql/sql.ts';\nimport type { PgDialect } from '../dialect.ts';\nimport { PgCountBuilder } from '../query-builders/count.ts';\nimport type { PgTable } from '../table.ts';\nimport type { PgViewBase } from '../view-base.ts';\nimport type { PgEffectSession } from './session.ts';\n\nexport interface PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase>\n\textends PgCountBuilder, Effect.Effect<number, TEffectHKT['error'], TEffectHKT['context']>\n{}\n\nexport class PgEffectCountBuilder<TEffectHKT extends QueryEffectHKTBase = QueryEffectHKTBase> extends PgCountBuilder {\n\tstatic override readonly [entityKind]: string = 'PgEffectCountBuilder';\n\n\tprotected session: PgEffectSession<TEffectHKT, any, any>;\n\n\tconstructor(\n\t\t{ source, dialect, filters, session }: {\n\t\t\tsource: PgTable | PgViewBase | SQL | SQLWrapper;\n\t\t\tfilters?: SQL<unknown>;\n\t\t\tdialect: PgDialect;\n\t\t\tsession: PgEffectSession<TEffectHKT, any, any>;\n\t\t},\n\t) {\n\t\tsuper({ source, dialect, filters });\n\t\tthis.session = session;\n\t}\n\n\texecute(placeholderValues?: Record<string, unknown>) {\n\t\treturn this.session.prepareQuery<{\n\t\t\texecute: number;\n\t\t\tobjects: unknown;\n\t\t\tarrays: unknown;\n\t\t\traw: unknown;\n\t\t}>(\n\t\t\tthis.build(),\n\t\t\t'arrays',\n\t\t\tfalse,\n\t\t\t(rows) => {\n\t\t\t\tconst v = rows[0]?.[0];\n\t\t\t\tif (typeof v === 'number') return v;\n\t\t\t\treturn v ? Number(v) : 0;\n\t\t\t},\n\t\t).execute(placeholderValues);\n\t}\n}\n\napplyEffectWrapper(PgEffectCountBuilder);\n"],"mappings":";;;;;AAcA,IAAa,uBAAb,cAAsG,eAAe;CACpH,QAA0B,cAAsB;CAEhD,AAAU;CAEV,YACC,EAAE,QAAQ,SAAS,SAAS,WAM3B;AACD,QAAM;GAAE;GAAQ;GAAS;GAAS,CAAC;AACnC,OAAK,UAAU;;CAGhB,QAAQ,mBAA6C;AACpD,SAAO,KAAK,QAAQ,aAMnB,KAAK,OAAO,EACZ,UACA,QACC,SAAS;GACT,MAAM,IAAI,KAAK,KAAK;AACpB,OAAI,OAAO,MAAM,SAAU,QAAO;AAClC,UAAO,IAAI,OAAO,EAAE,GAAG;IAExB,CAAC,QAAQ,kBAAkB;;;AAI9B,mBAAmB,qBAAqB"}
|
package/pg-core/effect/db.cjs
CHANGED
|
@@ -2,16 +2,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_pg_core_query_builders_query_builder = require('../query-builders/query-builder.cjs');
|
|
4
4
|
const require_pg_core_query_builders_update = require('../query-builders/update.cjs');
|
|
5
|
-
const require_pg_core_effect_raw = require('./raw.cjs');
|
|
6
|
-
const require_pg_core_effect_refresh_materialized_view = require('./refresh-materialized-view.cjs');
|
|
7
5
|
const require_pg_core_effect_delete = require('./delete.cjs');
|
|
8
6
|
const require_pg_core_effect_query = require('./query.cjs');
|
|
7
|
+
const require_pg_core_effect_raw = require('./raw.cjs');
|
|
8
|
+
const require_pg_core_effect_refresh_materialized_view = require('./refresh-materialized-view.cjs');
|
|
9
9
|
const require_pg_core_effect_update = require('./update.cjs');
|
|
10
10
|
let __entity_ts = require("../../entity.cjs");
|
|
11
11
|
let __subquery_ts = require("../../subquery.cjs");
|
|
12
|
+
let __codecs_ts = require("../../codecs.cjs");
|
|
12
13
|
let __sql_sql_ts = require("../../sql/sql.cjs");
|
|
13
|
-
let effect = require("effect");
|
|
14
14
|
let __selection_proxy_ts = require("../../selection-proxy.cjs");
|
|
15
|
+
let effect = require("effect");
|
|
15
16
|
let __pg_core_effect_count_ts = require("./count.cjs");
|
|
16
17
|
let __pg_core_effect_insert_ts = require("./insert.cjs");
|
|
17
18
|
let __pg_core_effect_select_ts = require("./select.cjs");
|
|
@@ -22,19 +23,10 @@ let __pg_core_query_builders_query_ts = require("../query-builders/query.cjs");
|
|
|
22
23
|
var PgEffectDatabase = class {
|
|
23
24
|
static [__entity_ts.entityKind] = "EffectPgDatabase";
|
|
24
25
|
query;
|
|
25
|
-
constructor(dialect, session, relations,
|
|
26
|
+
constructor(dialect, session, relations, parseRqbJson = false) {
|
|
26
27
|
this.dialect = dialect;
|
|
27
28
|
this.session = session;
|
|
28
|
-
this._ =
|
|
29
|
-
schema: schema.schema,
|
|
30
|
-
fullSchema: schema.fullSchema,
|
|
31
|
-
tableNamesMap: schema.tableNamesMap,
|
|
32
|
-
relations,
|
|
33
|
-
session
|
|
34
|
-
} : {
|
|
35
|
-
schema: void 0,
|
|
36
|
-
fullSchema: {},
|
|
37
|
-
tableNamesMap: {},
|
|
29
|
+
this._ = {
|
|
38
30
|
relations,
|
|
39
31
|
session
|
|
40
32
|
};
|
|
@@ -75,9 +67,11 @@ var PgEffectDatabase = class {
|
|
|
75
67
|
* ```
|
|
76
68
|
*/
|
|
77
69
|
$with = (alias, selection) => {
|
|
78
|
-
const self = this;
|
|
79
70
|
const as = (qb) => {
|
|
80
|
-
if (typeof qb === "function") qb = qb(new require_pg_core_query_builders_query_builder.QueryBuilder(
|
|
71
|
+
if (typeof qb === "function") qb = qb(new require_pg_core_query_builders_query_builder.QueryBuilder(new (Object.getPrototypeOf(this.dialect)).constructor({
|
|
72
|
+
casing: this.dialect.casing,
|
|
73
|
+
codecs: __codecs_ts.noopCodecs
|
|
74
|
+
})));
|
|
81
75
|
return new Proxy(new __subquery_ts.WithSubquery(qb.getSQL(), selection ?? ("getSelectedFields" in qb ? qb.getSelectedFields() ?? {} : {}), alias, true), new __selection_proxy_ts.SelectionProxyHandler({
|
|
82
76
|
alias,
|
|
83
77
|
sqlAliasedBehavior: "alias",
|
|
@@ -348,12 +342,10 @@ var PgEffectDatabase = class {
|
|
|
348
342
|
execute(query) {
|
|
349
343
|
const sequel = typeof query === "string" ? __sql_sql_ts.sql.raw(query) : query.getSQL();
|
|
350
344
|
const builtQuery = this.dialect.sqlToQuery(sequel);
|
|
351
|
-
const prepared = this.session.prepareQuery(builtQuery,
|
|
345
|
+
const prepared = this.session.prepareQuery(builtQuery, "raw", false);
|
|
352
346
|
return new require_pg_core_effect_raw.PgEffectRaw(() => prepared.execute(), sequel, builtQuery, (result) => prepared.mapResult(result, true));
|
|
353
347
|
}
|
|
354
|
-
transaction(transaction)
|
|
355
|
-
return this.session.transaction(transaction);
|
|
356
|
-
}
|
|
348
|
+
transaction = (tx) => this.session.transaction(tx);
|
|
357
349
|
};
|
|
358
350
|
const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(Math.random() * replicas.length)]) => {
|
|
359
351
|
const select = (...args) => getReplica(replicas).select(...args);
|
|
@@ -366,6 +358,7 @@ const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(
|
|
|
366
358
|
const insert = (...args) => primary.insert(...args);
|
|
367
359
|
const $delete = (...args) => primary.delete(...args);
|
|
368
360
|
const execute = (...args) => primary.execute(...args);
|
|
361
|
+
const transaction = (...args) => primary.transaction(...args);
|
|
369
362
|
const refreshMaterializedView = (...args) => primary.refreshMaterializedView(...args);
|
|
370
363
|
return {
|
|
371
364
|
...primary,
|
|
@@ -373,6 +366,7 @@ const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(
|
|
|
373
366
|
insert,
|
|
374
367
|
delete: $delete,
|
|
375
368
|
execute,
|
|
369
|
+
transaction,
|
|
376
370
|
refreshMaterializedView,
|
|
377
371
|
$primary: primary,
|
|
378
372
|
$replicas: replicas,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.cjs","names":["entityKind","RelationalQueryBuilder","PgEffectRelationalQuery","Effect","QueryBuilder","WithSubquery","SelectionProxyHandler","PgEffectCountBuilder","PgEffectSelectBase","PgUpdateBuilder","PgEffectUpdateBase","PgInsertBuilder","PgEffectInsertBase","PgEffectDeleteBase","PgEffectRefreshMaterializedView","sql","PgEffectRaw"],"sources":["../../../src/pg-core/effect/db.ts"],"sourcesContent":["import { Effect } from 'effect';\nimport type * as V1 from '~/_relations.ts';\nimport type { EffectCache } from '~/cache/core/cache-effect.ts';\nimport type { MutationOption } from '~/cache/core/cache.ts';\nimport type { QueryEffectHKTBase } from '~/effect-core/query-effect.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { PgDialect } from '~/pg-core/dialect.ts';\nimport { PgEffectCountBuilder } from '~/pg-core/effect/count.ts';\nimport { PgEffectInsertBase, type PgEffectInsertHKT } from '~/pg-core/effect/insert.ts';\nimport { PgEffectSelectBase, type PgEffectSelectBuilder } from '~/pg-core/effect/select.ts';\nimport type { _RelationalQueryBuilder } from '~/pg-core/query-builders/_query.ts';\nimport { PgInsertBuilder } from '~/pg-core/query-builders/insert.ts';\nimport { RelationalQueryBuilder } from '~/pg-core/query-builders/query.ts';\nimport type { PgTable } from '~/pg-core/table.ts';\nimport type { PgViewBase } from '~/pg-core/view-base.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type { AnyRelations, EmptyRelations } from '~/relations.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport { type ColumnsSelection, type SQL, sql, type SQLWrapper } from '~/sql/sql.ts';\nimport { WithSubquery } from '~/subquery.ts';\nimport type { PgColumn } from '../columns/common.ts';\nimport { QueryBuilder } from '../query-builders/query-builder.ts';\nimport type { SelectedFields } from '../query-builders/select.types.ts';\nimport { PgUpdateBuilder } from '../query-builders/update.ts';\nimport type { PgQueryResultHKT, PgQueryResultKind, PreparedQueryConfig } from '../session.ts';\nimport type { WithBuilder } from '../subquery.ts';\nimport type { PgMaterializedView } from '../view.ts';\nimport { PgEffectDeleteBase } from './delete.ts';\nimport { PgEffectRelationalQuery, type PgEffectRelationalQueryHKT } from './query.ts';\nimport { PgEffectRaw } from './raw.ts';\nimport { PgEffectRefreshMaterializedView } from './refresh-materialized-view.ts';\nimport type { PgEffectSession, PgEffectTransaction } from './session.ts';\nimport { PgEffectUpdateBase, type PgEffectUpdateHKT } from './update.ts';\n\nexport class PgEffectDatabase<\n\tTEffectHKT extends QueryEffectHKTBase,\n\tTQueryResult extends PgQueryResultHKT,\n\tTFullSchema extends Record<string, unknown> = Record<string, never>,\n\tTRelations extends AnyRelations = EmptyRelations,\n\tTSchema extends V1.TablesRelationalConfig = V1.ExtractTablesWithRelations<TFullSchema>,\n> {\n\tstatic readonly [entityKind]: string = 'EffectPgDatabase';\n\n\tdeclare readonly _: {\n\t\treadonly schema: TSchema | undefined;\n\t\treadonly fullSchema: TFullSchema;\n\t\treadonly tableNamesMap: Record<string, string>;\n\t\treadonly relations: TRelations;\n\t\treadonly session: PgEffectSession<TEffectHKT, TQueryResult, TFullSchema, TRelations, TSchema>;\n\t};\n\n\t// TO-DO: Figure out how to pass DrizzleTypeError without breaking withReplicas\n\tquery: {\n\t\t[K in keyof TRelations]: RelationalQueryBuilder<\n\t\t\tTRelations,\n\t\t\tTRelations[K],\n\t\t\tPgEffectRelationalQueryHKT<TEffectHKT>\n\t\t>;\n\t};\n\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly dialect: PgDialect,\n\t\t/** @internal */\n\t\treadonly session: PgEffectSession<TEffectHKT, any, any, any, any>,\n\t\trelations: TRelations,\n\t\tschema: V1.RelationalSchemaConfig<TSchema> | undefined,\n\t\tparseRqbJson: boolean = false,\n\t) {\n\t\tthis._ = schema\n\t\t\t? {\n\t\t\t\tschema: schema.schema,\n\t\t\t\tfullSchema: schema.fullSchema as TFullSchema,\n\t\t\t\ttableNamesMap: schema.tableNamesMap,\n\t\t\t\trelations: relations,\n\t\t\t\tsession,\n\t\t\t}\n\t\t\t: {\n\t\t\t\tschema: undefined,\n\t\t\t\tfullSchema: {} as TFullSchema,\n\t\t\t\ttableNamesMap: {},\n\t\t\t\trelations: relations,\n\t\t\t\tsession,\n\t\t\t};\n\n\t\tthis.query = {} as typeof this['query'];\n\t\tfor (const [tableName, relation] of Object.entries(relations)) {\n\t\t\t(this.query as PgEffectDatabase<\n\t\t\t\tTEffectHKT,\n\t\t\t\tTQueryResult,\n\t\t\t\tTSchema,\n\t\t\t\tAnyRelations,\n\t\t\t\tV1.TablesRelationalConfig\n\t\t\t>['query'])[tableName] = new RelationalQueryBuilder(\n\t\t\t\trelations,\n\t\t\t\trelations[relation.name]!.table as PgTable,\n\t\t\t\trelation,\n\t\t\t\tdialect,\n\t\t\t\tsession,\n\t\t\t\tparseRqbJson,\n\t\t\t\tPgEffectRelationalQuery,\n\t\t\t);\n\t\t}\n\n\t\tthis.$cache = {\n\t\t\tinvalidate: (_params: MutationOption) => Effect.void,\n\t\t};\n\t}\n\n\t/**\n\t * Creates a subquery that defines a temporary named result set as a CTE.\n\t *\n\t * It is useful for breaking down complex queries into simpler parts and for reusing the result set in subsequent parts of the query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param alias The alias for the subquery.\n\t *\n\t * Failure to provide an alias will result in a DrizzleTypeError, preventing the subquery from being referenced in other queries.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Create a subquery with alias 'sq' and use it in the select query\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * const result = yield* db.with(sq).select().from(sq);\n\t * ```\n\t *\n\t * To select arbitrary SQL values as fields in a CTE and reference them in other CTEs or in the main query, you need to add aliases to them:\n\t *\n\t * ```ts\n\t * // Select an arbitrary SQL value as a field in a CTE and reference it in the main query\n\t * const sq = db.$with('sq').as(db.select({\n\t * name: sql<string>`upper(${users.name})`.as('name'),\n\t * })\n\t * .from(users));\n\t *\n\t * const result = yield* db.with(sq).select({ name: sq.name }).from(sq);\n\t * ```\n\t */\n\t$with: WithBuilder = (alias: string, selection?: ColumnsSelection) => {\n\t\tconst self = this;\n\t\tconst as = (\n\t\t\tqb:\n\t\t\t\t| TypedQueryBuilder<ColumnsSelection | undefined>\n\t\t\t\t| SQL\n\t\t\t\t| ((qb: QueryBuilder) => TypedQueryBuilder<ColumnsSelection | undefined> | SQL),\n\t\t) => {\n\t\t\tif (typeof qb === 'function') {\n\t\t\t\tqb = qb(new QueryBuilder(self.dialect));\n\t\t\t}\n\n\t\t\treturn new Proxy(\n\t\t\t\tnew WithSubquery(\n\t\t\t\t\tqb.getSQL(),\n\t\t\t\t\tselection ?? ('getSelectedFields' in qb ? qb.getSelectedFields() ?? {} : {}) as SelectedFields,\n\t\t\t\t\talias,\n\t\t\t\t\ttrue,\n\t\t\t\t),\n\t\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t\t);\n\t\t};\n\t\treturn { as };\n\t};\n\n\t$cache: { invalidate: EffectCache['onMutate'] };\n\n\t$count(\n\t\tsource: PgTable | PgViewBase | SQL | SQLWrapper,\n\t\tfilters?: SQL<unknown>,\n\t) {\n\t\treturn new PgEffectCountBuilder({ source, filters, session: this.session, dialect: this.dialect });\n\t}\n\n\t/**\n\t * Incorporates a previously defined CTE (using `$with`) into the main query.\n\t *\n\t * This method allows the main query to reference a temporary named result set.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param queries The CTEs to incorporate into the main query.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Define a subquery 'sq' as a CTE using $with\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * // Incorporate the CTE 'sq' into the main query and select from it\n\t * const result = yield* db.with(sq).select().from(sq);\n\t * ```\n\t */\n\twith(...queries: WithSubquery[]) {\n\t\tconst self = this;\n\n\t\t/**\n\t\t * Creates a select query.\n\t\t *\n\t\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Select all columns and all rows from the 'cars' table\n\t\t * const allCars: Car[] = yield* db.select().from(cars);\n\t\t *\n\t\t * // Select specific columns and all rows from the 'cars' table\n\t\t * const carsIdsAndBrands: { id: number; brand: string }[] = yield* db.select({\n\t\t * id: cars.id,\n\t\t * brand: cars.brand\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t *\n\t\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t\t *\n\t\t * ```ts\n\t\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = yield* db.select({\n\t\t * id: cars.id,\n\t\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t */\n\t\tfunction select(): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\t\tfunction select<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\t\tfunction select<TSelection extends SelectedFields>(\n\t\t\tfields?: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection | undefined, TEffectHKT> {\n\t\t\treturn new PgEffectSelectBase({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Adds `distinct` expression to the select query.\n\t\t *\n\t\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * // Select all unique rows from the 'cars' table\n\t\t * yield* db.selectDistinct()\n\t\t * .from(cars)\n\t\t * .orderBy(cars.id, cars.brand, cars.color);\n\t\t *\n\t\t * // Select all unique brands from the 'cars' table\n\t\t * yield* db.selectDistinct({ brand: cars.brand })\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand);\n\t\t * ```\n\t\t */\n\t\tfunction selectDistinct(): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\t\tfunction selectDistinct<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\t\tfunction selectDistinct<TSelection extends SelectedFields>(\n\t\t\tfields?: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection | undefined, TEffectHKT> {\n\t\t\treturn new PgEffectSelectBase({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: true,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Adds `distinct on` expression to the select query.\n\t\t *\n\t\t * Calling this method will specify how the unique rows are determined.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t\t *\n\t\t * @param on The expression defining uniqueness.\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * // Select the first row for each unique brand from the 'cars' table\n\t\t * yield* db.selectDistinctOn([cars.brand])\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand);\n\t\t *\n\t\t * // Selects the first occurrence of each unique car brand along with its color from the 'cars' table\n\t\t * yield* db.selectDistinctOn([cars.brand], { brand: cars.brand, color: cars.color })\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand, cars.color);\n\t\t * ```\n\t\t */\n\t\tfunction selectDistinctOn(on: (PgColumn | SQLWrapper)[]): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\t\tfunction selectDistinctOn<TSelection extends SelectedFields>(\n\t\t\ton: (PgColumn | SQLWrapper)[],\n\t\t\tfields: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\t\tfunction selectDistinctOn<TSelection extends SelectedFields>(\n\t\t\ton: (PgColumn | SQLWrapper)[],\n\t\t\tfields?: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection | undefined, TEffectHKT> {\n\t\t\treturn new PgEffectSelectBase({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: { on },\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Creates an update query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t\t *\n\t\t * Use `.set()` method to specify which values to update.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t\t *\n\t\t * @param table The table to update.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Update all rows in the 'cars' table\n\t\t * yield* db.update(cars).set({ color: 'red' });\n\t\t *\n\t\t * // Update rows with filters and conditions\n\t\t * yield* db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t\t *\n\t\t * // Update with returning clause\n\t\t * const updatedCar: Car[] = yield* db.update(cars)\n\t\t * .set({ color: 'red' })\n\t\t * .where(eq(cars.id, 1))\n\t\t * .returning();\n\t\t * ```\n\t\t */\n\t\tfunction update<TTable extends PgTable>(\n\t\t\ttable: TTable,\n\t\t): PgUpdateBuilder<TTable, TQueryResult, PgEffectUpdateHKT<TEffectHKT>> {\n\t\t\treturn new PgUpdateBuilder(table, self.session, self.dialect, queries, PgEffectUpdateBase);\n\t\t}\n\n\t\t/**\n\t\t * Creates an insert query.\n\t\t *\n\t\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t\t *\n\t\t * @param table The table to insert into.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Insert one row\n\t\t * yield* db.insert(cars).values({ brand: 'BMW' });\n\t\t *\n\t\t * // Insert multiple rows\n\t\t * yield* db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t\t *\n\t\t * // Insert with returning clause\n\t\t * const insertedCar: Car[] = yield* db.insert(cars)\n\t\t * .values({ brand: 'BMW' })\n\t\t * .returning();\n\t\t * ```\n\t\t */\n\t\tfunction insert<TTable extends PgTable>(\n\t\t\ttable: TTable,\n\t\t): PgInsertBuilder<TTable, TQueryResult, false, PgEffectInsertHKT<TEffectHKT>> {\n\t\t\treturn new PgInsertBuilder(table, self.session, self.dialect, queries, undefined, PgEffectInsertBase);\n\t\t}\n\n\t\t/**\n\t\t * Creates a delete query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t\t *\n\t\t * @param table The table to delete from.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Delete all rows in the 'cars' table\n\t\t * yield* db.delete(cars);\n\t\t *\n\t\t * // Delete rows with filters and conditions\n\t\t * yield* db.delete(cars).where(eq(cars.color, 'green'));\n\t\t *\n\t\t * // Delete with returning clause\n\t\t * const deletedCar: Car[] = yield* db.delete(cars)\n\t\t * .where(eq(cars.id, 1))\n\t\t * .returning();\n\t\t * ```\n\t\t */\n\t\tfunction delete_<TTable extends PgTable>(\n\t\t\ttable: TTable,\n\t\t): PgEffectDeleteBase<TTable, TQueryResult, undefined, undefined, false, never, TEffectHKT> {\n\t\t\treturn new PgEffectDeleteBase(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\treturn { select, selectDistinct, selectDistinctOn, update, insert, delete: delete_ };\n\t}\n\n\t/**\n\t * Creates a select query.\n\t *\n\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all columns and all rows from the 'cars' table\n\t * const allCars: Car[] = yield* db.select().from(cars);\n\t *\n\t * // Select specific columns and all rows from the 'cars' table\n\t * const carsIdsAndBrands: { id: number; brand: string }[] = yield* db.select({\n\t * id: cars.id,\n\t * brand: cars.brand\n\t * })\n\t * .from(cars);\n\t * ```\n\t *\n\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t *\n\t * ```ts\n\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = yield* db.select({\n\t * id: cars.id,\n\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t * })\n\t * .from(cars);\n\t * ```\n\t */\n\tselect(): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\tselect<TSelection extends SelectedFields>(fields: TSelection): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\tselect<TSelection extends SelectedFields | undefined>(\n\t\tfields?: TSelection,\n\t): PgEffectSelectBuilder<TSelection, TEffectHKT> {\n\t\treturn new PgEffectSelectBase({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t});\n\t}\n\n\t/**\n\t * Adds `distinct` expression to the select query.\n\t *\n\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t * ```ts\n\t * // Select all unique rows from the 'cars' table\n\t * yield* db.selectDistinct()\n\t * .from(cars)\n\t * .orderBy(cars.id, cars.brand, cars.color);\n\t *\n\t * // Select all unique brands from the 'cars' table\n\t * yield* db.selectDistinct({ brand: cars.brand })\n\t * .from(cars)\n\t * .orderBy(cars.brand);\n\t * ```\n\t */\n\tselectDistinct(): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\tselectDistinct<TSelection extends SelectedFields>(fields: TSelection): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\tselectDistinct<TSelection extends SelectedFields | undefined>(\n\t\tfields?: TSelection,\n\t): PgEffectSelectBuilder<TSelection | undefined, TEffectHKT> {\n\t\treturn new PgEffectSelectBase({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\tdistinct: true,\n\t\t});\n\t}\n\n\t/**\n\t * Adds `distinct on` expression to the select query.\n\t *\n\t * Calling this method will specify how the unique rows are determined.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t *\n\t * @param on The expression defining uniqueness.\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t * ```ts\n\t * // Select the first row for each unique brand from the 'cars' table\n\t * yield* db.selectDistinctOn([cars.brand])\n\t * .from(cars)\n\t * .orderBy(cars.brand);\n\t *\n\t * // Selects the first occurrence of each unique car brand along with its color from the 'cars' table\n\t * yield* db.selectDistinctOn([cars.brand], { brand: cars.brand, color: cars.color })\n\t * .from(cars)\n\t * .orderBy(cars.brand, cars.color);\n\t * ```\n\t */\n\tselectDistinctOn(on: (PgColumn | SQLWrapper)[]): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\tselectDistinctOn<TSelection extends SelectedFields>(\n\t\ton: (PgColumn | SQLWrapper)[],\n\t\tfields: TSelection,\n\t): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\tselectDistinctOn<TSelection extends SelectedFields | undefined>(\n\t\ton: (PgColumn | SQLWrapper)[],\n\t\tfields?: TSelection,\n\t): PgEffectSelectBuilder<TSelection, TEffectHKT> {\n\t\treturn new PgEffectSelectBase({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\tdistinct: { on },\n\t\t});\n\t}\n\n\t/**\n\t * Creates an update query.\n\t *\n\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t *\n\t * Use `.set()` method to specify which values to update.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t *\n\t * @param table The table to update.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Update all rows in the 'cars' table\n\t * yield* db.update(cars).set({ color: 'red' });\n\t *\n\t * // Update rows with filters and conditions\n\t * yield* db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t *\n\t * // Update with returning clause\n\t * const updatedCar: Car[] = yield* db.update(cars)\n\t * .set({ color: 'red' })\n\t * .where(eq(cars.id, 1))\n\t * .returning();\n\t * ```\n\t */\n\tupdate<TTable extends PgTable>(table: TTable): PgUpdateBuilder<TTable, TQueryResult, PgEffectUpdateHKT<TEffectHKT>> {\n\t\treturn new PgUpdateBuilder(table, this.session, this.dialect, undefined, PgEffectUpdateBase);\n\t}\n\n\t/**\n\t * Creates an insert query.\n\t *\n\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t *\n\t * @param table The table to insert into.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Insert one row\n\t * yield* db.insert(cars).values({ brand: 'BMW' });\n\t *\n\t * // Insert multiple rows\n\t * yield* db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t *\n\t * // Insert with returning clause\n\t * const insertedCar: Car[] = yield* db.insert(cars)\n\t * .values({ brand: 'BMW' })\n\t * .returning();\n\t * ```\n\t */\n\tinsert<TTable extends PgTable>(\n\t\ttable: TTable,\n\t): PgInsertBuilder<TTable, TQueryResult, false, PgEffectInsertHKT<TEffectHKT>> {\n\t\treturn new PgInsertBuilder(table, this.session, this.dialect, undefined, undefined, PgEffectInsertBase);\n\t}\n\n\t/**\n\t * Creates a delete query.\n\t *\n\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t *\n\t * @param table The table to delete from.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Delete all rows in the 'cars' table\n\t * yield* db.delete(cars);\n\t *\n\t * // Delete rows with filters and conditions\n\t * yield* db.delete(cars).where(eq(cars.color, 'green'));\n\t *\n\t * // Delete with returning clause\n\t * const deletedCar: Car[] = yield* db.delete(cars)\n\t * .where(eq(cars.id, 1))\n\t * .returning();\n\t * ```\n\t */\n\tdelete<TTable extends PgTable>(\n\t\ttable: TTable,\n\t): PgEffectDeleteBase<TTable, TQueryResult, undefined, undefined, false, never, TEffectHKT> {\n\t\treturn new PgEffectDeleteBase(table, this.session, this.dialect);\n\t}\n\n\trefreshMaterializedView<TView extends PgMaterializedView>(\n\t\tview: TView,\n\t): PgEffectRefreshMaterializedView<TQueryResult, TEffectHKT> {\n\t\treturn new PgEffectRefreshMaterializedView(view, this.session, this.dialect);\n\t}\n\n\texecute<TRow extends Record<string, unknown>>(\n\t\tquery: SQLWrapper | string,\n\t): PgEffectRaw<PgQueryResultKind<TQueryResult, TRow>, TEffectHKT> {\n\t\tconst sequel = typeof query === 'string' ? sql.raw(query) : query.getSQL();\n\t\tconst builtQuery = this.dialect.sqlToQuery(sequel);\n\t\tconst prepared = this.session.prepareQuery<\n\t\t\tPreparedQueryConfig & { execute: PgQueryResultKind<TQueryResult, TRow> }\n\t\t>(\n\t\t\tbuiltQuery,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tfalse,\n\t\t);\n\t\treturn new PgEffectRaw(\n\t\t\t() => prepared.execute(),\n\t\t\tsequel,\n\t\t\tbuiltQuery,\n\t\t\t(result) => prepared.mapResult(result, true),\n\t\t);\n\t}\n\n\ttransaction<A, E, R>(\n\t\ttransaction: (\n\t\t\ttx: PgEffectTransaction<TEffectHKT, TQueryResult, TFullSchema, TRelations, TSchema>,\n\t\t) => Effect.Effect<A, E, R>,\n\t) {\n\t\treturn this.session.transaction(\n\t\t\ttransaction,\n\t\t);\n\t}\n}\n\nexport type PgEffectWithReplicas<Q> = Q & { $primary: Q; $replicas: Q[] };\n\nexport const withReplicas = <\n\tTEffectHKT extends QueryEffectHKTBase,\n\tHKT extends PgQueryResultHKT,\n\tTFullSchema extends Record<string, unknown>,\n\tTRelations extends AnyRelations,\n\tTSchema extends V1.TablesRelationalConfig,\n\tQ extends PgEffectDatabase<\n\t\tTEffectHKT,\n\t\tHKT,\n\t\tTFullSchema,\n\t\tTRelations,\n\t\tTSchema extends Record<string, unknown> ? V1.ExtractTablesWithRelations<TFullSchema> : TSchema\n\t>,\n>(\n\tprimary: Q,\n\treplicas: [Q, ...Q[]],\n\tgetReplica: (replicas: Q[]) => Q = () => replicas[Math.floor(Math.random() * replicas.length)]!,\n): PgEffectWithReplicas<Q> => {\n\tconst select: Q['select'] = (...args: []) => getReplica(replicas).select(...args);\n\tconst selectDistinct: Q['selectDistinct'] = (...args: []) => getReplica(replicas).selectDistinct(...args);\n\tconst selectDistinctOn: Q['selectDistinctOn'] = (...args: [any]) => getReplica(replicas).selectDistinctOn(...args);\n\tconst $count: Q['$count'] = (...args: [any]) => getReplica(replicas).$count(...args);\n\tconst _with: Q['with'] = (...args: any) => getReplica(replicas).with(...args);\n\tconst $with: Q['$with'] = (arg: any) => getReplica(replicas).$with(arg) as any;\n\n\tconst update: Q['update'] = (...args: [any]) => primary.update(...args);\n\tconst insert: Q['insert'] = (...args: [any]) => primary.insert(...args);\n\tconst $delete: Q['delete'] = (...args: [any]) => primary.delete(...args);\n\tconst execute: Q['execute'] = (...args: [any]) => primary.execute(...args);\n\t// const transaction: Q['transaction'] = (...args: [any]) => primary.transaction(...args);\n\tconst refreshMaterializedView: Q['refreshMaterializedView'] = (...args: [any]) =>\n\t\tprimary.refreshMaterializedView(...args);\n\n\treturn {\n\t\t...primary,\n\t\tupdate,\n\t\tinsert,\n\t\tdelete: $delete,\n\t\texecute,\n\t\t// transaction,\n\t\trefreshMaterializedView,\n\t\t$primary: primary,\n\t\t$replicas: replicas,\n\t\tselect,\n\t\tselectDistinct,\n\t\tselectDistinctOn,\n\t\t$count,\n\t\t$with,\n\t\twith: _with,\n\t\tget query() {\n\t\t\treturn getReplica(replicas).query;\n\t\t},\n\t};\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"db.cjs","names":["entityKind","RelationalQueryBuilder","PgEffectRelationalQuery","Effect","QueryBuilder","noopCodecs","WithSubquery","SelectionProxyHandler","PgEffectCountBuilder","PgEffectSelectBase","PgUpdateBuilder","PgEffectUpdateBase","PgInsertBuilder","PgEffectInsertBase","PgEffectDeleteBase","PgEffectRefreshMaterializedView","sql","PgEffectRaw"],"sources":["../../../src/pg-core/effect/db.ts"],"sourcesContent":["import type { SqlError } from '@effect/sql/SqlError';\nimport { Effect } from 'effect';\nimport type { EffectCache } from '~/cache/core/cache-effect.ts';\nimport type { MutationOption } from '~/cache/core/cache.ts';\nimport { noopCodecs } from '~/codecs.ts';\nimport type { QueryEffectHKTBase } from '~/effect-core/query-effect.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { PgDialect } from '~/pg-core/dialect.ts';\nimport { PgEffectCountBuilder } from '~/pg-core/effect/count.ts';\nimport { PgEffectInsertBase, type PgEffectInsertHKT } from '~/pg-core/effect/insert.ts';\nimport { PgEffectSelectBase, type PgEffectSelectBuilder } from '~/pg-core/effect/select.ts';\nimport { PgInsertBuilder } from '~/pg-core/query-builders/insert.ts';\nimport { RelationalQueryBuilder } from '~/pg-core/query-builders/query.ts';\nimport type { PgTable } from '~/pg-core/table.ts';\nimport type { PgViewBase } from '~/pg-core/view-base.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type { AnyRelations, EmptyRelations } from '~/relations.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport { type ColumnsSelection, type SQL, sql, type SQLWrapper } from '~/sql/sql.ts';\nimport { WithSubquery } from '~/subquery.ts';\nimport type { PgColumn } from '../columns/common.ts';\nimport { QueryBuilder } from '../query-builders/query-builder.ts';\nimport type { SelectedFields } from '../query-builders/select.types.ts';\nimport { PgUpdateBuilder } from '../query-builders/update.ts';\nimport type { PgQueryResultHKT, PgQueryResultKind, PreparedQueryConfig } from '../session.ts';\nimport type { WithBuilder } from '../subquery.ts';\nimport type { PgMaterializedView } from '../view.ts';\nimport { PgEffectDeleteBase } from './delete.ts';\nimport { PgEffectRelationalQuery, type PgEffectRelationalQueryHKT } from './query.ts';\nimport { PgEffectRaw } from './raw.ts';\nimport { PgEffectRefreshMaterializedView } from './refresh-materialized-view.ts';\nimport type { PgEffectSession, PgEffectTransaction } from './session.ts';\nimport { PgEffectUpdateBase, type PgEffectUpdateHKT } from './update.ts';\n\nexport class PgEffectDatabase<\n\tTEffectHKT extends QueryEffectHKTBase,\n\tTQueryResult extends PgQueryResultHKT,\n\tTRelations extends AnyRelations = EmptyRelations,\n> {\n\tstatic readonly [entityKind]: string = 'EffectPgDatabase';\n\n\tdeclare readonly _: {\n\t\treadonly relations: TRelations;\n\t\treadonly session: PgEffectSession<TEffectHKT, TQueryResult, TRelations>;\n\t};\n\n\t// TO-DO: Figure out how to pass DrizzleTypeError without breaking withReplicas\n\tquery: {\n\t\t[K in keyof TRelations]: RelationalQueryBuilder<\n\t\t\tTRelations,\n\t\t\tTRelations[K],\n\t\t\tPgEffectRelationalQueryHKT<TEffectHKT>\n\t\t>;\n\t};\n\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly dialect: PgDialect,\n\t\t/** @internal */\n\t\treadonly session: PgEffectSession<TEffectHKT, any, any>,\n\t\trelations: TRelations,\n\t\tparseRqbJson: boolean = false,\n\t) {\n\t\tthis._ = {\n\t\t\trelations: relations,\n\t\t\tsession,\n\t\t};\n\n\t\tthis.query = {} as typeof this['query'];\n\t\tfor (const [tableName, relation] of Object.entries(relations)) {\n\t\t\t(this.query as PgEffectDatabase<\n\t\t\t\tTEffectHKT,\n\t\t\t\tTQueryResult,\n\t\t\t\tAnyRelations\n\t\t\t>['query'])[tableName] = new RelationalQueryBuilder(\n\t\t\t\trelations,\n\t\t\t\trelations[relation.name]!.table as PgTable,\n\t\t\t\trelation,\n\t\t\t\tdialect,\n\t\t\t\tsession,\n\t\t\t\tparseRqbJson,\n\t\t\t\tPgEffectRelationalQuery,\n\t\t\t);\n\t\t}\n\n\t\tthis.$cache = {\n\t\t\tinvalidate: (_params: MutationOption) => Effect.void,\n\t\t};\n\t}\n\n\t/**\n\t * Creates a subquery that defines a temporary named result set as a CTE.\n\t *\n\t * It is useful for breaking down complex queries into simpler parts and for reusing the result set in subsequent parts of the query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param alias The alias for the subquery.\n\t *\n\t * Failure to provide an alias will result in a DrizzleTypeError, preventing the subquery from being referenced in other queries.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Create a subquery with alias 'sq' and use it in the select query\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * const result = yield* db.with(sq).select().from(sq);\n\t * ```\n\t *\n\t * To select arbitrary SQL values as fields in a CTE and reference them in other CTEs or in the main query, you need to add aliases to them:\n\t *\n\t * ```ts\n\t * // Select an arbitrary SQL value as a field in a CTE and reference it in the main query\n\t * const sq = db.$with('sq').as(db.select({\n\t * name: sql<string>`upper(${users.name})`.as('name'),\n\t * })\n\t * .from(users));\n\t *\n\t * const result = yield* db.with(sq).select({ name: sq.name }).from(sq);\n\t * ```\n\t */\n\t$with: WithBuilder = (alias: string, selection?: ColumnsSelection) => {\n\t\tconst as = (\n\t\t\tqb:\n\t\t\t\t| TypedQueryBuilder<ColumnsSelection | undefined>\n\t\t\t\t| SQL\n\t\t\t\t| ((qb: QueryBuilder) => TypedQueryBuilder<ColumnsSelection | undefined> | SQL),\n\t\t) => {\n\t\t\tif (typeof qb === 'function') {\n\t\t\t\tqb = qb(\n\t\t\t\t\tnew QueryBuilder(\n\t\t\t\t\t\t// Need to recreate dialect without codecs as to not affect selection within subquery\n\t\t\t\t\t\t// as codecs must only modify selection at an output\n\t\t\t\t\t\tnew (Object.getPrototypeOf(this.dialect).constructor as typeof PgDialect)({\n\t\t\t\t\t\t\tcasing: this.dialect.casing,\n\t\t\t\t\t\t\tcodecs: noopCodecs,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn new Proxy(\n\t\t\t\tnew WithSubquery(\n\t\t\t\t\tqb.getSQL(),\n\t\t\t\t\tselection ?? ('getSelectedFields' in qb ? qb.getSelectedFields() ?? {} : {}) as SelectedFields,\n\t\t\t\t\talias,\n\t\t\t\t\ttrue,\n\t\t\t\t),\n\t\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t\t);\n\t\t};\n\t\treturn { as };\n\t};\n\n\t$cache: { invalidate: EffectCache['onMutate'] };\n\n\t$count(\n\t\tsource: PgTable | PgViewBase | SQL | SQLWrapper,\n\t\tfilters?: SQL<unknown>,\n\t) {\n\t\treturn new PgEffectCountBuilder({ source, filters, session: this.session, dialect: this.dialect });\n\t}\n\n\t/**\n\t * Incorporates a previously defined CTE (using `$with`) into the main query.\n\t *\n\t * This method allows the main query to reference a temporary named result set.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param queries The CTEs to incorporate into the main query.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Define a subquery 'sq' as a CTE using $with\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * // Incorporate the CTE 'sq' into the main query and select from it\n\t * const result = yield* db.with(sq).select().from(sq);\n\t * ```\n\t */\n\twith(...queries: WithSubquery[]) {\n\t\tconst self = this;\n\n\t\t/**\n\t\t * Creates a select query.\n\t\t *\n\t\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Select all columns and all rows from the 'cars' table\n\t\t * const allCars: Car[] = yield* db.select().from(cars);\n\t\t *\n\t\t * // Select specific columns and all rows from the 'cars' table\n\t\t * const carsIdsAndBrands: { id: number; brand: string }[] = yield* db.select({\n\t\t * id: cars.id,\n\t\t * brand: cars.brand\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t *\n\t\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t\t *\n\t\t * ```ts\n\t\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = yield* db.select({\n\t\t * id: cars.id,\n\t\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t */\n\t\tfunction select(): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\t\tfunction select<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\t\tfunction select<TSelection extends SelectedFields>(\n\t\t\tfields?: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection | undefined, TEffectHKT> {\n\t\t\treturn new PgEffectSelectBase({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Adds `distinct` expression to the select query.\n\t\t *\n\t\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * // Select all unique rows from the 'cars' table\n\t\t * yield* db.selectDistinct()\n\t\t * .from(cars)\n\t\t * .orderBy(cars.id, cars.brand, cars.color);\n\t\t *\n\t\t * // Select all unique brands from the 'cars' table\n\t\t * yield* db.selectDistinct({ brand: cars.brand })\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand);\n\t\t * ```\n\t\t */\n\t\tfunction selectDistinct(): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\t\tfunction selectDistinct<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\t\tfunction selectDistinct<TSelection extends SelectedFields>(\n\t\t\tfields?: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection | undefined, TEffectHKT> {\n\t\t\treturn new PgEffectSelectBase({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: true,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Adds `distinct on` expression to the select query.\n\t\t *\n\t\t * Calling this method will specify how the unique rows are determined.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t\t *\n\t\t * @param on The expression defining uniqueness.\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * // Select the first row for each unique brand from the 'cars' table\n\t\t * yield* db.selectDistinctOn([cars.brand])\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand);\n\t\t *\n\t\t * // Selects the first occurrence of each unique car brand along with its color from the 'cars' table\n\t\t * yield* db.selectDistinctOn([cars.brand], { brand: cars.brand, color: cars.color })\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand, cars.color);\n\t\t * ```\n\t\t */\n\t\tfunction selectDistinctOn(on: (PgColumn | SQLWrapper)[]): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\t\tfunction selectDistinctOn<TSelection extends SelectedFields>(\n\t\t\ton: (PgColumn | SQLWrapper)[],\n\t\t\tfields: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\t\tfunction selectDistinctOn<TSelection extends SelectedFields>(\n\t\t\ton: (PgColumn | SQLWrapper)[],\n\t\t\tfields?: TSelection,\n\t\t): PgEffectSelectBuilder<TSelection | undefined, TEffectHKT> {\n\t\t\treturn new PgEffectSelectBase({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: { on },\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Creates an update query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t\t *\n\t\t * Use `.set()` method to specify which values to update.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t\t *\n\t\t * @param table The table to update.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Update all rows in the 'cars' table\n\t\t * yield* db.update(cars).set({ color: 'red' });\n\t\t *\n\t\t * // Update rows with filters and conditions\n\t\t * yield* db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t\t *\n\t\t * // Update with returning clause\n\t\t * const updatedCar: Car[] = yield* db.update(cars)\n\t\t * .set({ color: 'red' })\n\t\t * .where(eq(cars.id, 1))\n\t\t * .returning();\n\t\t * ```\n\t\t */\n\t\tfunction update<TTable extends PgTable>(\n\t\t\ttable: TTable,\n\t\t): PgUpdateBuilder<TTable, TQueryResult, PgEffectUpdateHKT<TEffectHKT>> {\n\t\t\treturn new PgUpdateBuilder(table, self.session, self.dialect, queries, PgEffectUpdateBase);\n\t\t}\n\n\t\t/**\n\t\t * Creates an insert query.\n\t\t *\n\t\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t\t *\n\t\t * @param table The table to insert into.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Insert one row\n\t\t * yield* db.insert(cars).values({ brand: 'BMW' });\n\t\t *\n\t\t * // Insert multiple rows\n\t\t * yield* db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t\t *\n\t\t * // Insert with returning clause\n\t\t * const insertedCar: Car[] = yield* db.insert(cars)\n\t\t * .values({ brand: 'BMW' })\n\t\t * .returning();\n\t\t * ```\n\t\t */\n\t\tfunction insert<TTable extends PgTable>(\n\t\t\ttable: TTable,\n\t\t): PgInsertBuilder<TTable, TQueryResult, false, PgEffectInsertHKT<TEffectHKT>> {\n\t\t\treturn new PgInsertBuilder(table, self.session, self.dialect, queries, undefined, PgEffectInsertBase);\n\t\t}\n\n\t\t/**\n\t\t * Creates a delete query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t\t *\n\t\t * @param table The table to delete from.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Delete all rows in the 'cars' table\n\t\t * yield* db.delete(cars);\n\t\t *\n\t\t * // Delete rows with filters and conditions\n\t\t * yield* db.delete(cars).where(eq(cars.color, 'green'));\n\t\t *\n\t\t * // Delete with returning clause\n\t\t * const deletedCar: Car[] = yield* db.delete(cars)\n\t\t * .where(eq(cars.id, 1))\n\t\t * .returning();\n\t\t * ```\n\t\t */\n\t\tfunction delete_<TTable extends PgTable>(\n\t\t\ttable: TTable,\n\t\t): PgEffectDeleteBase<TTable, TQueryResult, undefined, undefined, false, never, TEffectHKT> {\n\t\t\treturn new PgEffectDeleteBase(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\treturn { select, selectDistinct, selectDistinctOn, update, insert, delete: delete_ };\n\t}\n\n\t/**\n\t * Creates a select query.\n\t *\n\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all columns and all rows from the 'cars' table\n\t * const allCars: Car[] = yield* db.select().from(cars);\n\t *\n\t * // Select specific columns and all rows from the 'cars' table\n\t * const carsIdsAndBrands: { id: number; brand: string }[] = yield* db.select({\n\t * id: cars.id,\n\t * brand: cars.brand\n\t * })\n\t * .from(cars);\n\t * ```\n\t *\n\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t *\n\t * ```ts\n\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = yield* db.select({\n\t * id: cars.id,\n\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t * })\n\t * .from(cars);\n\t * ```\n\t */\n\tselect(): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\tselect<TSelection extends SelectedFields>(fields: TSelection): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\tselect<TSelection extends SelectedFields | undefined>(\n\t\tfields?: TSelection,\n\t): PgEffectSelectBuilder<TSelection, TEffectHKT> {\n\t\treturn new PgEffectSelectBase({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t});\n\t}\n\n\t/**\n\t * Adds `distinct` expression to the select query.\n\t *\n\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t * ```ts\n\t * // Select all unique rows from the 'cars' table\n\t * yield* db.selectDistinct()\n\t * .from(cars)\n\t * .orderBy(cars.id, cars.brand, cars.color);\n\t *\n\t * // Select all unique brands from the 'cars' table\n\t * yield* db.selectDistinct({ brand: cars.brand })\n\t * .from(cars)\n\t * .orderBy(cars.brand);\n\t * ```\n\t */\n\tselectDistinct(): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\tselectDistinct<TSelection extends SelectedFields>(fields: TSelection): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\tselectDistinct<TSelection extends SelectedFields | undefined>(\n\t\tfields?: TSelection,\n\t): PgEffectSelectBuilder<TSelection | undefined, TEffectHKT> {\n\t\treturn new PgEffectSelectBase({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\tdistinct: true,\n\t\t});\n\t}\n\n\t/**\n\t * Adds `distinct on` expression to the select query.\n\t *\n\t * Calling this method will specify how the unique rows are determined.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t *\n\t * @param on The expression defining uniqueness.\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t * ```ts\n\t * // Select the first row for each unique brand from the 'cars' table\n\t * yield* db.selectDistinctOn([cars.brand])\n\t * .from(cars)\n\t * .orderBy(cars.brand);\n\t *\n\t * // Selects the first occurrence of each unique car brand along with its color from the 'cars' table\n\t * yield* db.selectDistinctOn([cars.brand], { brand: cars.brand, color: cars.color })\n\t * .from(cars)\n\t * .orderBy(cars.brand, cars.color);\n\t * ```\n\t */\n\tselectDistinctOn(on: (PgColumn | SQLWrapper)[]): PgEffectSelectBuilder<undefined, TEffectHKT>;\n\tselectDistinctOn<TSelection extends SelectedFields>(\n\t\ton: (PgColumn | SQLWrapper)[],\n\t\tfields: TSelection,\n\t): PgEffectSelectBuilder<TSelection, TEffectHKT>;\n\tselectDistinctOn<TSelection extends SelectedFields | undefined>(\n\t\ton: (PgColumn | SQLWrapper)[],\n\t\tfields?: TSelection,\n\t): PgEffectSelectBuilder<TSelection, TEffectHKT> {\n\t\treturn new PgEffectSelectBase({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\tdistinct: { on },\n\t\t});\n\t}\n\n\t/**\n\t * Creates an update query.\n\t *\n\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t *\n\t * Use `.set()` method to specify which values to update.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t *\n\t * @param table The table to update.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Update all rows in the 'cars' table\n\t * yield* db.update(cars).set({ color: 'red' });\n\t *\n\t * // Update rows with filters and conditions\n\t * yield* db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t *\n\t * // Update with returning clause\n\t * const updatedCar: Car[] = yield* db.update(cars)\n\t * .set({ color: 'red' })\n\t * .where(eq(cars.id, 1))\n\t * .returning();\n\t * ```\n\t */\n\tupdate<TTable extends PgTable>(table: TTable): PgUpdateBuilder<TTable, TQueryResult, PgEffectUpdateHKT<TEffectHKT>> {\n\t\treturn new PgUpdateBuilder(table, this.session, this.dialect, undefined, PgEffectUpdateBase);\n\t}\n\n\t/**\n\t * Creates an insert query.\n\t *\n\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t *\n\t * @param table The table to insert into.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Insert one row\n\t * yield* db.insert(cars).values({ brand: 'BMW' });\n\t *\n\t * // Insert multiple rows\n\t * yield* db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t *\n\t * // Insert with returning clause\n\t * const insertedCar: Car[] = yield* db.insert(cars)\n\t * .values({ brand: 'BMW' })\n\t * .returning();\n\t * ```\n\t */\n\tinsert<TTable extends PgTable>(\n\t\ttable: TTable,\n\t): PgInsertBuilder<TTable, TQueryResult, false, PgEffectInsertHKT<TEffectHKT>> {\n\t\treturn new PgInsertBuilder(table, this.session, this.dialect, undefined, undefined, PgEffectInsertBase);\n\t}\n\n\t/**\n\t * Creates a delete query.\n\t *\n\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t *\n\t * @param table The table to delete from.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Delete all rows in the 'cars' table\n\t * yield* db.delete(cars);\n\t *\n\t * // Delete rows with filters and conditions\n\t * yield* db.delete(cars).where(eq(cars.color, 'green'));\n\t *\n\t * // Delete with returning clause\n\t * const deletedCar: Car[] = yield* db.delete(cars)\n\t * .where(eq(cars.id, 1))\n\t * .returning();\n\t * ```\n\t */\n\tdelete<TTable extends PgTable>(\n\t\ttable: TTable,\n\t): PgEffectDeleteBase<TTable, TQueryResult, undefined, undefined, false, never, TEffectHKT> {\n\t\treturn new PgEffectDeleteBase(table, this.session, this.dialect);\n\t}\n\n\trefreshMaterializedView<TView extends PgMaterializedView>(\n\t\tview: TView,\n\t): PgEffectRefreshMaterializedView<TQueryResult, TEffectHKT> {\n\t\treturn new PgEffectRefreshMaterializedView(view, this.session, this.dialect);\n\t}\n\n\texecute<TRow extends Record<string, unknown>>(\n\t\tquery: SQLWrapper | string,\n\t): PgEffectRaw<PgQueryResultKind<TQueryResult, TRow>, TEffectHKT> {\n\t\tconst sequel = typeof query === 'string' ? sql.raw(query) : query.getSQL();\n\t\tconst builtQuery = this.dialect.sqlToQuery(sequel);\n\t\tconst prepared = this.session.prepareQuery<\n\t\t\tPreparedQueryConfig & { execute: PgQueryResultKind<TQueryResult, TRow> }\n\t\t>(\n\t\t\tbuiltQuery,\n\t\t\t'raw',\n\t\t\tfalse,\n\t\t);\n\t\treturn new PgEffectRaw(\n\t\t\t() => prepared.execute(),\n\t\t\tsequel,\n\t\t\tbuiltQuery,\n\t\t\t(result) => prepared.mapResult(result, true),\n\t\t);\n\t}\n\n\ttransaction: <A, E, R>(\n\t\ttransaction: (\n\t\t\ttx: PgEffectTransaction<TEffectHKT, TQueryResult, TRelations>,\n\t\t) => Effect.Effect<A, E, R>,\n\t) => Effect.Effect<A, E | SqlError, R> = (tx) => this.session.transaction(tx);\n}\n\nexport type PgEffectWithReplicas<Q> = Q & { $primary: Q; $replicas: Q[] };\n\nexport const withReplicas = <\n\tTEffectHKT extends QueryEffectHKTBase,\n\tHKT extends PgQueryResultHKT,\n\tTRelations extends AnyRelations,\n\tQ extends PgEffectDatabase<TEffectHKT, HKT, TRelations>,\n>(\n\tprimary: Q,\n\treplicas: [Q, ...Q[]],\n\tgetReplica: (replicas: Q[]) => Q = () => replicas[Math.floor(Math.random() * replicas.length)]!,\n): PgEffectWithReplicas<Q> => {\n\tconst select: Q['select'] = (...args: []) => getReplica(replicas).select(...args);\n\tconst selectDistinct: Q['selectDistinct'] = (...args: []) => getReplica(replicas).selectDistinct(...args);\n\tconst selectDistinctOn: Q['selectDistinctOn'] = (...args: [any]) => getReplica(replicas).selectDistinctOn(...args);\n\tconst $count: Q['$count'] = (...args: [any]) => getReplica(replicas).$count(...args);\n\tconst _with: Q['with'] = (...args: any) => getReplica(replicas).with(...args);\n\tconst $with: Q['$with'] = (arg: any) => getReplica(replicas).$with(arg) as any;\n\n\tconst update: Q['update'] = (...args: [any]) => primary.update(...args);\n\tconst insert: Q['insert'] = (...args: [any]) => primary.insert(...args);\n\tconst $delete: Q['delete'] = (...args: [any]) => primary.delete(...args);\n\tconst execute: Q['execute'] = (...args: [any]) => primary.execute(...args);\n\tconst transaction: Q['transaction'] = (...args: [any]) => primary.transaction(...args);\n\tconst refreshMaterializedView: Q['refreshMaterializedView'] = (...args: [any]) =>\n\t\tprimary.refreshMaterializedView(...args);\n\n\treturn {\n\t\t...primary,\n\t\tupdate,\n\t\tinsert,\n\t\tdelete: $delete,\n\t\texecute,\n\t\ttransaction,\n\t\trefreshMaterializedView,\n\t\t$primary: primary,\n\t\t$replicas: replicas,\n\t\tselect,\n\t\tselectDistinct,\n\t\tselectDistinctOn,\n\t\t$count,\n\t\t$with,\n\t\twith: _with,\n\t\tget query() {\n\t\t\treturn getReplica(replicas).query;\n\t\t},\n\t};\n};\n"],"mappings":"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"}
|
package/pg-core/effect/db.d.cts
CHANGED
|
@@ -13,37 +13,33 @@ import { PgEffectSession, PgEffectTransaction } from "./session.cjs";
|
|
|
13
13
|
import { entityKind } from "../../entity.cjs";
|
|
14
14
|
import { SQL, SQLWrapper } from "../../sql/sql.cjs";
|
|
15
15
|
import { WithSubquery } from "../../subquery.cjs";
|
|
16
|
-
import * as V1 from "../../_relations.cjs";
|
|
17
16
|
import { AnyRelations, EmptyRelations } from "../../relations.cjs";
|
|
18
17
|
import { PgTable } from "../table.cjs";
|
|
19
18
|
import { PgViewBase } from "../view-base.cjs";
|
|
20
19
|
import { PgDialect } from "../dialect.cjs";
|
|
20
|
+
import { PgInsertBuilder } from "../query-builders/insert.cjs";
|
|
21
21
|
import { EffectCache } from "../../cache/core/cache-effect.cjs";
|
|
22
|
-
import
|
|
22
|
+
import { SqlError } from "@effect/sql/SqlError";
|
|
23
23
|
import { QueryEffectHKTBase } from "../../effect-core/query-effect.cjs";
|
|
24
24
|
import { Effect } from "effect";
|
|
25
25
|
import { PgEffectCountBuilder } from "./count.cjs";
|
|
26
26
|
import { PgEffectInsertHKT } from "./insert.cjs";
|
|
27
27
|
import { PgEffectSelectBuilder } from "./select.cjs";
|
|
28
|
-
import { PgInsertBuilder } from "../query-builders/insert.cjs";
|
|
29
28
|
import { RelationalQueryBuilder } from "../query-builders/query.cjs";
|
|
30
29
|
|
|
31
30
|
//#region src/pg-core/effect/db.d.ts
|
|
32
|
-
declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResult extends PgQueryResultHKT,
|
|
31
|
+
declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResult extends PgQueryResultHKT, TRelations extends AnyRelations = EmptyRelations> {
|
|
33
32
|
static readonly [entityKind]: string;
|
|
34
33
|
readonly _: {
|
|
35
|
-
readonly schema: TSchema | undefined;
|
|
36
|
-
readonly fullSchema: TFullSchema;
|
|
37
|
-
readonly tableNamesMap: Record<string, string>;
|
|
38
34
|
readonly relations: TRelations;
|
|
39
|
-
readonly session: PgEffectSession<TEffectHKT, TQueryResult,
|
|
35
|
+
readonly session: PgEffectSession<TEffectHKT, TQueryResult, TRelations>;
|
|
40
36
|
};
|
|
41
37
|
query: { [K in keyof TRelations]: RelationalQueryBuilder<TRelations, TRelations[K], PgEffectRelationalQueryHKT<TEffectHKT>> };
|
|
42
38
|
constructor(/** @internal */
|
|
43
39
|
|
|
44
40
|
dialect: PgDialect, /** @internal */
|
|
45
41
|
|
|
46
|
-
session: PgEffectSession<TEffectHKT, any, any
|
|
42
|
+
session: PgEffectSession<TEffectHKT, any, any>, relations: TRelations, parseRqbJson?: boolean);
|
|
47
43
|
/**
|
|
48
44
|
* Creates a subquery that defines a temporary named result set as a CTE.
|
|
49
45
|
*
|
|
@@ -288,13 +284,13 @@ declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResu
|
|
|
288
284
|
delete<TTable extends PgTable>(table: TTable): PgEffectDeleteBase<TTable, TQueryResult, undefined, undefined, false, never, TEffectHKT>;
|
|
289
285
|
refreshMaterializedView<TView extends PgMaterializedView>(view: TView): PgEffectRefreshMaterializedView<TQueryResult, TEffectHKT>;
|
|
290
286
|
execute<TRow extends Record<string, unknown>>(query: SQLWrapper | string): PgEffectRaw<PgQueryResultKind<TQueryResult, TRow>, TEffectHKT>;
|
|
291
|
-
transaction<A, E, R>(transaction: (tx: PgEffectTransaction<TEffectHKT, TQueryResult,
|
|
287
|
+
transaction: <A, E, R>(transaction: (tx: PgEffectTransaction<TEffectHKT, TQueryResult, TRelations>) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | SqlError, R>;
|
|
292
288
|
}
|
|
293
289
|
type PgEffectWithReplicas<Q> = Q & {
|
|
294
290
|
$primary: Q;
|
|
295
291
|
$replicas: Q[];
|
|
296
292
|
};
|
|
297
|
-
declare const withReplicas: <TEffectHKT extends QueryEffectHKTBase, HKT extends PgQueryResultHKT,
|
|
293
|
+
declare const withReplicas: <TEffectHKT extends QueryEffectHKTBase, HKT extends PgQueryResultHKT, TRelations extends AnyRelations, Q extends PgEffectDatabase<TEffectHKT, HKT, TRelations>>(primary: Q, replicas: [Q, ...Q[]], getReplica?: (replicas: Q[]) => Q) => PgEffectWithReplicas<Q>;
|
|
298
294
|
//#endregion
|
|
299
295
|
export { PgEffectDatabase, PgEffectWithReplicas, withReplicas };
|
|
300
296
|
//# sourceMappingURL=db.d.cts.map
|
package/pg-core/effect/db.d.ts
CHANGED
|
@@ -13,37 +13,33 @@ import { PgEffectSession, PgEffectTransaction } from "./session.js";
|
|
|
13
13
|
import { entityKind } from "../../entity.js";
|
|
14
14
|
import { WithSubquery } from "../../subquery.js";
|
|
15
15
|
import { SQL, SQLWrapper } from "../../sql/sql.js";
|
|
16
|
-
import
|
|
16
|
+
import { AnyRelations, EmptyRelations } from "../../relations.js";
|
|
17
17
|
import { PgDialect } from "../dialect.js";
|
|
18
|
-
import { Effect } from "effect";
|
|
19
18
|
import { EffectCache } from "../../cache/core/cache-effect.js";
|
|
20
|
-
import {
|
|
19
|
+
import { Effect } from "effect";
|
|
21
20
|
import { PgTable } from "../table.js";
|
|
22
21
|
import { PgViewBase } from "../view-base.js";
|
|
23
|
-
import { QueryEffectHKTBase } from "../../effect-core/query-effect.js";
|
|
24
22
|
import { PgEffectCountBuilder } from "./count.js";
|
|
25
23
|
import { PgEffectInsertHKT } from "./insert.js";
|
|
26
24
|
import { PgEffectSelectBuilder } from "./select.js";
|
|
27
25
|
import { PgInsertBuilder } from "../query-builders/insert.js";
|
|
28
26
|
import { RelationalQueryBuilder } from "../query-builders/query.js";
|
|
29
|
-
import
|
|
27
|
+
import { QueryEffectHKTBase } from "../../effect-core/query-effect.js";
|
|
28
|
+
import { SqlError } from "@effect/sql/SqlError";
|
|
30
29
|
|
|
31
30
|
//#region src/pg-core/effect/db.d.ts
|
|
32
|
-
declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResult extends PgQueryResultHKT,
|
|
31
|
+
declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResult extends PgQueryResultHKT, TRelations extends AnyRelations = EmptyRelations> {
|
|
33
32
|
static readonly [entityKind]: string;
|
|
34
33
|
readonly _: {
|
|
35
|
-
readonly schema: TSchema | undefined;
|
|
36
|
-
readonly fullSchema: TFullSchema;
|
|
37
|
-
readonly tableNamesMap: Record<string, string>;
|
|
38
34
|
readonly relations: TRelations;
|
|
39
|
-
readonly session: PgEffectSession<TEffectHKT, TQueryResult,
|
|
35
|
+
readonly session: PgEffectSession<TEffectHKT, TQueryResult, TRelations>;
|
|
40
36
|
};
|
|
41
37
|
query: { [K in keyof TRelations]: RelationalQueryBuilder<TRelations, TRelations[K], PgEffectRelationalQueryHKT<TEffectHKT>> };
|
|
42
38
|
constructor(/** @internal */
|
|
43
39
|
|
|
44
40
|
dialect: PgDialect, /** @internal */
|
|
45
41
|
|
|
46
|
-
session: PgEffectSession<TEffectHKT, any, any
|
|
42
|
+
session: PgEffectSession<TEffectHKT, any, any>, relations: TRelations, parseRqbJson?: boolean);
|
|
47
43
|
/**
|
|
48
44
|
* Creates a subquery that defines a temporary named result set as a CTE.
|
|
49
45
|
*
|
|
@@ -288,13 +284,13 @@ declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResu
|
|
|
288
284
|
delete<TTable extends PgTable>(table: TTable): PgEffectDeleteBase<TTable, TQueryResult, undefined, undefined, false, never, TEffectHKT>;
|
|
289
285
|
refreshMaterializedView<TView extends PgMaterializedView>(view: TView): PgEffectRefreshMaterializedView<TQueryResult, TEffectHKT>;
|
|
290
286
|
execute<TRow extends Record<string, unknown>>(query: SQLWrapper | string): PgEffectRaw<PgQueryResultKind<TQueryResult, TRow>, TEffectHKT>;
|
|
291
|
-
transaction<A, E, R>(transaction: (tx: PgEffectTransaction<TEffectHKT, TQueryResult,
|
|
287
|
+
transaction: <A, E, R>(transaction: (tx: PgEffectTransaction<TEffectHKT, TQueryResult, TRelations>) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | SqlError, R>;
|
|
292
288
|
}
|
|
293
289
|
type PgEffectWithReplicas<Q> = Q & {
|
|
294
290
|
$primary: Q;
|
|
295
291
|
$replicas: Q[];
|
|
296
292
|
};
|
|
297
|
-
declare const withReplicas: <TEffectHKT extends QueryEffectHKTBase, HKT extends PgQueryResultHKT,
|
|
293
|
+
declare const withReplicas: <TEffectHKT extends QueryEffectHKTBase, HKT extends PgQueryResultHKT, TRelations extends AnyRelations, Q extends PgEffectDatabase<TEffectHKT, HKT, TRelations>>(primary: Q, replicas: [Q, ...Q[]], getReplica?: (replicas: Q[]) => Q) => PgEffectWithReplicas<Q>;
|
|
298
294
|
//#endregion
|
|
299
295
|
export { PgEffectDatabase, PgEffectWithReplicas, withReplicas };
|
|
300
296
|
//# sourceMappingURL=db.d.ts.map
|
package/pg-core/effect/db.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { QueryBuilder } from "../query-builders/query-builder.js";
|
|
2
2
|
import { PgUpdateBuilder } from "../query-builders/update.js";
|
|
3
|
-
import { PgEffectRaw } from "./raw.js";
|
|
4
|
-
import { PgEffectRefreshMaterializedView } from "./refresh-materialized-view.js";
|
|
5
3
|
import { PgEffectDeleteBase } from "./delete.js";
|
|
6
4
|
import { PgEffectRelationalQuery } from "./query.js";
|
|
5
|
+
import { PgEffectRaw } from "./raw.js";
|
|
6
|
+
import { PgEffectRefreshMaterializedView } from "./refresh-materialized-view.js";
|
|
7
7
|
import { PgEffectUpdateBase } from "./update.js";
|
|
8
8
|
import { entityKind } from "../../entity.js";
|
|
9
9
|
import { WithSubquery } from "../../subquery.js";
|
|
10
|
+
import { noopCodecs } from "../../codecs.js";
|
|
10
11
|
import { sql } from "../../sql/sql.js";
|
|
11
|
-
import { Effect } from "effect";
|
|
12
12
|
import { SelectionProxyHandler } from "../../selection-proxy.js";
|
|
13
|
+
import { Effect } from "effect";
|
|
13
14
|
import { PgEffectCountBuilder } from "./count.js";
|
|
14
15
|
import { PgEffectInsertBase } from "./insert.js";
|
|
15
16
|
import { PgEffectSelectBase } from "./select.js";
|
|
@@ -20,19 +21,10 @@ import { RelationalQueryBuilder } from "../query-builders/query.js";
|
|
|
20
21
|
var PgEffectDatabase = class {
|
|
21
22
|
static [entityKind] = "EffectPgDatabase";
|
|
22
23
|
query;
|
|
23
|
-
constructor(dialect, session, relations,
|
|
24
|
+
constructor(dialect, session, relations, parseRqbJson = false) {
|
|
24
25
|
this.dialect = dialect;
|
|
25
26
|
this.session = session;
|
|
26
|
-
this._ =
|
|
27
|
-
schema: schema.schema,
|
|
28
|
-
fullSchema: schema.fullSchema,
|
|
29
|
-
tableNamesMap: schema.tableNamesMap,
|
|
30
|
-
relations,
|
|
31
|
-
session
|
|
32
|
-
} : {
|
|
33
|
-
schema: void 0,
|
|
34
|
-
fullSchema: {},
|
|
35
|
-
tableNamesMap: {},
|
|
27
|
+
this._ = {
|
|
36
28
|
relations,
|
|
37
29
|
session
|
|
38
30
|
};
|
|
@@ -73,9 +65,11 @@ var PgEffectDatabase = class {
|
|
|
73
65
|
* ```
|
|
74
66
|
*/
|
|
75
67
|
$with = (alias, selection) => {
|
|
76
|
-
const self = this;
|
|
77
68
|
const as = (qb) => {
|
|
78
|
-
if (typeof qb === "function") qb = qb(new QueryBuilder(
|
|
69
|
+
if (typeof qb === "function") qb = qb(new QueryBuilder(new (Object.getPrototypeOf(this.dialect)).constructor({
|
|
70
|
+
casing: this.dialect.casing,
|
|
71
|
+
codecs: noopCodecs
|
|
72
|
+
})));
|
|
79
73
|
return new Proxy(new WithSubquery(qb.getSQL(), selection ?? ("getSelectedFields" in qb ? qb.getSelectedFields() ?? {} : {}), alias, true), new SelectionProxyHandler({
|
|
80
74
|
alias,
|
|
81
75
|
sqlAliasedBehavior: "alias",
|
|
@@ -346,12 +340,10 @@ var PgEffectDatabase = class {
|
|
|
346
340
|
execute(query) {
|
|
347
341
|
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
|
|
348
342
|
const builtQuery = this.dialect.sqlToQuery(sequel);
|
|
349
|
-
const prepared = this.session.prepareQuery(builtQuery,
|
|
343
|
+
const prepared = this.session.prepareQuery(builtQuery, "raw", false);
|
|
350
344
|
return new PgEffectRaw(() => prepared.execute(), sequel, builtQuery, (result) => prepared.mapResult(result, true));
|
|
351
345
|
}
|
|
352
|
-
transaction(transaction)
|
|
353
|
-
return this.session.transaction(transaction);
|
|
354
|
-
}
|
|
346
|
+
transaction = (tx) => this.session.transaction(tx);
|
|
355
347
|
};
|
|
356
348
|
const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(Math.random() * replicas.length)]) => {
|
|
357
349
|
const select = (...args) => getReplica(replicas).select(...args);
|
|
@@ -364,6 +356,7 @@ const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(
|
|
|
364
356
|
const insert = (...args) => primary.insert(...args);
|
|
365
357
|
const $delete = (...args) => primary.delete(...args);
|
|
366
358
|
const execute = (...args) => primary.execute(...args);
|
|
359
|
+
const transaction = (...args) => primary.transaction(...args);
|
|
367
360
|
const refreshMaterializedView = (...args) => primary.refreshMaterializedView(...args);
|
|
368
361
|
return {
|
|
369
362
|
...primary,
|
|
@@ -371,6 +364,7 @@ const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(
|
|
|
371
364
|
insert,
|
|
372
365
|
delete: $delete,
|
|
373
366
|
execute,
|
|
367
|
+
transaction,
|
|
374
368
|
refreshMaterializedView,
|
|
375
369
|
$primary: primary,
|
|
376
370
|
$replicas: replicas,
|