drizzle-orm 1.0.0-beta.20-afec359 → 1.0.0-beta.21
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 +13 -2
- package/_relations.d.ts +13 -2
- package/_relations.js.map +1 -1
- package/alias.cjs +1 -1
- package/alias.js +1 -1
- package/aws-data-api/common/index.cjs +0 -2
- package/aws-data-api/common/index.cjs.map +1 -1
- package/aws-data-api/common/index.js +0 -2
- package/aws-data-api/common/index.js.map +1 -1
- package/aws-data-api/pg/driver.cjs +20 -93
- package/aws-data-api/pg/driver.cjs.map +1 -1
- package/aws-data-api/pg/driver.d.cts +13 -17
- package/aws-data-api/pg/driver.d.ts +13 -17
- package/aws-data-api/pg/driver.js +20 -93
- 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 +113 -44
- package/aws-data-api/pg/session.cjs.map +1 -1
- package/aws-data-api/pg/session.d.cts +42 -12
- package/aws-data-api/pg/session.d.ts +43 -13
- package/aws-data-api/pg/session.js +114 -46
- package/aws-data-api/pg/session.js.map +1 -1
- package/better-sqlite3/driver.cjs +2 -5
- package/better-sqlite3/driver.cjs.map +1 -1
- package/better-sqlite3/driver.d.ts +1 -1
- package/better-sqlite3/driver.js +2 -5
- package/better-sqlite3/driver.js.map +1 -1
- package/better-sqlite3/session.cjs +15 -16
- package/better-sqlite3/session.cjs.map +1 -1
- package/better-sqlite3/session.d.cts +6 -10
- package/better-sqlite3/session.d.ts +7 -11
- package/better-sqlite3/session.js +16 -17
- package/better-sqlite3/session.js.map +1 -1
- package/bun-sql/driver.cjs.map +1 -1
- package/bun-sql/driver.d.cts +6 -7
- package/bun-sql/driver.d.ts +6 -7
- package/bun-sql/driver.js.map +1 -1
- package/bun-sql/index.cjs +1 -0
- 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 +3 -4
- package/bun-sql/mysql/driver.cjs.map +1 -1
- package/bun-sql/mysql/driver.js +2 -3
- package/bun-sql/mysql/driver.js.map +1 -1
- package/bun-sql/mysql/session.cjs +24 -37
- package/bun-sql/mysql/session.cjs.map +1 -1
- package/bun-sql/mysql/session.d.cts +4 -10
- package/bun-sql/mysql/session.d.ts +6 -12
- package/bun-sql/mysql/session.js +25 -38
- package/bun-sql/mysql/session.js.map +1 -1
- package/bun-sql/postgres/driver.cjs +20 -144
- package/bun-sql/postgres/driver.cjs.map +1 -1
- package/bun-sql/postgres/driver.d.cts +6 -10
- package/bun-sql/postgres/driver.d.ts +7 -11
- package/bun-sql/postgres/driver.js +20 -144
- 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 +112 -17
- package/bun-sql/postgres/session.cjs.map +1 -1
- package/bun-sql/postgres/session.d.cts +33 -11
- package/bun-sql/postgres/session.d.ts +34 -12
- package/bun-sql/postgres/session.js +112 -18
- package/bun-sql/postgres/session.js.map +1 -1
- package/bun-sql/session.cjs +1 -0
- 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 +3 -4
- package/bun-sql/sqlite/driver.cjs.map +1 -1
- package/bun-sql/sqlite/driver.d.ts +1 -1
- package/bun-sql/sqlite/driver.js +2 -3
- package/bun-sql/sqlite/driver.js.map +1 -1
- package/bun-sql/sqlite/session.cjs +17 -18
- package/bun-sql/sqlite/session.cjs.map +1 -1
- package/bun-sql/sqlite/session.d.cts +6 -9
- package/bun-sql/sqlite/session.d.ts +7 -10
- package/bun-sql/sqlite/session.js +18 -19
- package/bun-sql/sqlite/session.js.map +1 -1
- package/bun-sqlite/driver.cjs +2 -5
- package/bun-sqlite/driver.cjs.map +1 -1
- package/bun-sqlite/driver.d.ts +1 -1
- package/bun-sqlite/driver.js +2 -5
- package/bun-sqlite/driver.js.map +1 -1
- package/bun-sqlite/session.cjs +14 -15
- package/bun-sqlite/session.cjs.map +1 -1
- package/bun-sqlite/session.d.cts +6 -10
- package/bun-sqlite/session.d.ts +6 -10
- package/bun-sqlite/session.js +15 -16
- 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 +4 -10
- package/cockroach/driver.cjs.map +1 -1
- package/cockroach/driver.d.cts +0 -1
- package/cockroach/driver.d.ts +2 -3
- package/cockroach/driver.js +4 -10
- package/cockroach/driver.js.map +1 -1
- package/cockroach/session.cjs +9 -7
- package/cockroach/session.cjs.map +1 -1
- package/cockroach/session.d.cts +3 -5
- package/cockroach/session.d.ts +5 -7
- package/cockroach/session.js +10 -8
- 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 +4 -0
- package/cockroach-core/query-builders/raw.cjs.map +1 -1
- package/cockroach-core/query-builders/raw.js +4 -0
- 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/column.cjs +5 -10
- package/column.cjs.map +1 -1
- package/column.d.cts +3 -3
- package/column.d.ts +3 -3
- package/column.js +5 -10
- package/column.js.map +1 -1
- package/d1/driver.cjs +2 -3
- package/d1/driver.cjs.map +1 -1
- package/d1/driver.d.ts +1 -1
- package/d1/driver.js +2 -3
- package/d1/driver.js.map +1 -1
- package/d1/session.cjs +15 -17
- package/d1/session.cjs.map +1 -1
- package/d1/session.d.cts +6 -9
- package/d1/session.d.ts +7 -10
- package/d1/session.js +16 -18
- package/d1/session.js.map +1 -1
- package/durable-sqlite/driver.cjs +2 -5
- package/durable-sqlite/driver.cjs.map +1 -1
- package/durable-sqlite/driver.d.ts +1 -1
- package/durable-sqlite/driver.js +2 -5
- 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 +14 -15
- package/durable-sqlite/session.cjs.map +1 -1
- package/durable-sqlite/session.d.cts +6 -10
- package/durable-sqlite/session.d.ts +6 -10
- package/durable-sqlite/session.js +15 -16
- 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 +14 -100
- package/effect-postgres/driver.cjs.map +1 -1
- package/effect-postgres/driver.d.cts +8 -12
- package/effect-postgres/driver.d.ts +10 -14
- package/effect-postgres/driver.js +14 -100
- 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 +71 -12
- package/effect-postgres/session.cjs.map +1 -1
- package/effect-postgres/session.d.cts +31 -14
- package/effect-postgres/session.d.ts +34 -17
- package/effect-postgres/session.js +71 -13
- 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 +2 -5
- package/expo-sqlite/driver.cjs.map +1 -1
- package/expo-sqlite/driver.d.ts +1 -1
- package/expo-sqlite/driver.js +2 -5
- package/expo-sqlite/driver.js.map +1 -1
- package/expo-sqlite/session.cjs +14 -15
- package/expo-sqlite/session.cjs.map +1 -1
- package/expo-sqlite/session.d.cts +6 -10
- package/expo-sqlite/session.d.ts +6 -10
- package/expo-sqlite/session.js +15 -16
- package/expo-sqlite/session.js.map +1 -1
- package/gel/driver.cjs +3 -5
- package/gel/driver.cjs.map +1 -1
- package/gel/driver.d.cts +0 -1
- package/gel/driver.d.ts +4 -5
- package/gel/driver.js +3 -5
- 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 +5 -8
- package/gel/session.d.ts +9 -12
- 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 +5 -13
- 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 +5 -13
- package/gel-core/query-builders/query.js.map +1 -1
- package/gel-core/query-builders/raw.cjs +4 -0
- package/gel-core/query-builders/raw.cjs.map +1 -1
- package/gel-core/query-builders/raw.js +4 -0
- 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 +6 -12
- package/index.d.cts +6 -6
- package/index.d.ts +6 -6
- package/index.js +9 -9
- package/libsql/driver-core.cjs +2 -3
- package/libsql/driver-core.cjs.map +1 -1
- package/libsql/driver-core.d.ts +1 -1
- package/libsql/driver-core.js +2 -3
- package/libsql/driver-core.js.map +1 -1
- package/libsql/session.cjs +15 -14
- package/libsql/session.cjs.map +1 -1
- package/libsql/session.d.cts +6 -9
- package/libsql/session.d.ts +7 -10
- package/libsql/session.js +16 -15
- 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 +5 -13
- 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 +5 -13
- package/mysql-core/query-builders/query.js.map +1 -1
- package/mysql-core/session.cjs +2 -1
- package/mysql-core/session.cjs.map +1 -1
- package/mysql-core/session.d.cts +4 -3
- package/mysql-core/session.d.ts +4 -3
- package/mysql-core/session.js +2 -1
- 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 +2 -5
- package/mysql-proxy/driver.cjs.map +1 -1
- package/mysql-proxy/driver.js +2 -5
- package/mysql-proxy/driver.js.map +1 -1
- package/mysql-proxy/session.cjs +19 -26
- package/mysql-proxy/session.cjs.map +1 -1
- package/mysql-proxy/session.d.cts +4 -11
- package/mysql-proxy/session.d.ts +6 -13
- package/mysql-proxy/session.js +20 -27
- package/mysql-proxy/session.js.map +1 -1
- package/mysql2/driver.cjs +2 -3
- package/mysql2/driver.cjs.map +1 -1
- package/mysql2/driver.d.cts +0 -1
- package/mysql2/driver.d.ts +3 -4
- package/mysql2/driver.js +2 -3
- package/mysql2/driver.js.map +1 -1
- package/mysql2/session.cjs +39 -49
- package/mysql2/session.cjs.map +1 -1
- package/mysql2/session.d.cts +4 -11
- package/mysql2/session.d.ts +6 -13
- package/mysql2/session.js +40 -50
- package/mysql2/session.js.map +1 -1
- package/neon-http/driver.cjs +65 -34
- package/neon-http/driver.cjs.map +1 -1
- package/neon-http/driver.d.cts +19 -15
- package/neon-http/driver.d.ts +20 -16
- package/neon-http/driver.js +64 -34
- package/neon-http/driver.js.map +1 -1
- package/neon-http/index.cjs +4 -2
- 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 +117 -28
- package/neon-http/session.cjs.map +1 -1
- package/neon-http/session.d.cts +38 -10
- package/neon-http/session.d.ts +40 -12
- package/neon-http/session.js +117 -30
- package/neon-http/session.js.map +1 -1
- package/neon-serverless/driver.cjs +32 -14
- package/neon-serverless/driver.cjs.map +1 -1
- package/neon-serverless/driver.d.cts +17 -12
- package/neon-serverless/driver.d.ts +18 -13
- package/neon-serverless/driver.js +31 -14
- package/neon-serverless/driver.js.map +1 -1
- package/neon-serverless/index.cjs +3 -2
- 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 +108 -32
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.d.cts +32 -9
- package/neon-serverless/session.d.ts +33 -10
- package/neon-serverless/session.js +109 -34
- package/neon-serverless/session.js.map +1 -1
- package/netlify-db/driver.cjs +123 -0
- package/netlify-db/driver.cjs.map +1 -0
- package/netlify-db/driver.d.cts +90 -0
- package/netlify-db/driver.d.ts +90 -0
- package/netlify-db/driver.js +113 -0
- package/netlify-db/driver.js.map +1 -0
- package/netlify-db/index.cjs +15 -0
- package/netlify-db/index.d.cts +3 -0
- package/netlify-db/index.d.ts +3 -0
- package/netlify-db/index.js +4 -0
- package/netlify-db/migrator.cjs +17 -0
- package/netlify-db/migrator.cjs.map +1 -0
- package/netlify-db/migrator.d.cts +11 -0
- package/netlify-db/migrator.d.ts +11 -0
- package/netlify-db/migrator.js +15 -0
- package/netlify-db/migrator.js.map +1 -0
- package/netlify-db/session.cjs +153 -0
- package/netlify-db/session.cjs.map +1 -0
- package/netlify-db/session.d.cts +68 -0
- package/netlify-db/session.d.ts +68 -0
- package/netlify-db/session.js +149 -0
- package/netlify-db/session.js.map +1 -0
- package/node-mssql/driver.cjs +3 -9
- package/node-mssql/driver.cjs.map +1 -1
- package/node-mssql/driver.d.cts +0 -1
- package/node-mssql/driver.d.ts +2 -3
- package/node-mssql/driver.js +3 -9
- package/node-mssql/driver.js.map +1 -1
- package/node-mssql/session.cjs +4 -6
- package/node-mssql/session.cjs.map +1 -1
- package/node-mssql/session.d.cts +1 -4
- package/node-mssql/session.d.ts +3 -6
- package/node-mssql/session.js +5 -7
- package/node-mssql/session.js.map +1 -1
- package/node-postgres/driver.cjs +18 -15
- package/node-postgres/driver.cjs.map +1 -1
- package/node-postgres/driver.d.cts +6 -11
- package/node-postgres/driver.d.ts +7 -12
- package/node-postgres/driver.js +18 -15
- 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 +126 -33
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.d.cts +30 -10
- package/node-postgres/session.d.ts +31 -11
- package/node-postgres/session.js +127 -35
- 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 +9 -4
- package/node-sqlite/session.cjs.map +1 -1
- package/node-sqlite/session.d.cts +4 -3
- package/node-sqlite/session.d.ts +5 -4
- package/node-sqlite/session.js +9 -4
- package/node-sqlite/session.js.map +1 -1
- package/op-sqlite/driver.cjs +2 -3
- package/op-sqlite/driver.cjs.map +1 -1
- package/op-sqlite/driver.d.ts +1 -1
- package/op-sqlite/driver.js +2 -3
- package/op-sqlite/driver.js.map +1 -1
- package/op-sqlite/session.cjs +16 -18
- package/op-sqlite/session.cjs.map +1 -1
- package/op-sqlite/session.d.cts +6 -10
- package/op-sqlite/session.d.ts +7 -11
- package/op-sqlite/session.js +17 -19
- package/op-sqlite/session.js.map +1 -1
- package/operations.d.cts +0 -3
- package/operations.d.ts +0 -3
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +4736 -4700
- package/pg-core/async/count.cjs +9 -2
- package/pg-core/async/count.cjs.map +1 -1
- package/pg-core/async/count.js +9 -2
- package/pg-core/async/count.js.map +1 -1
- package/pg-core/async/db.cjs +27 -10
- package/pg-core/async/db.cjs.map +1 -1
- package/pg-core/async/db.d.cts +13 -5
- package/pg-core/async/db.d.ts +16 -8
- package/pg-core/async/db.js +27 -10
- package/pg-core/async/db.js.map +1 -1
- package/pg-core/async/delete.cjs +13 -8
- package/pg-core/async/delete.cjs.map +1 -1
- package/pg-core/async/delete.js +13 -8
- package/pg-core/async/delete.js.map +1 -1
- package/pg-core/async/insert.cjs +12 -7
- package/pg-core/async/insert.cjs.map +1 -1
- package/pg-core/async/insert.js +12 -7
- package/pg-core/async/insert.js.map +1 -1
- package/pg-core/async/query.cjs +14 -8
- package/pg-core/async/query.cjs.map +1 -1
- package/pg-core/async/query.js +14 -8
- package/pg-core/async/query.js.map +1 -1
- package/pg-core/async/refresh-materialized-view.cjs +9 -1
- package/pg-core/async/refresh-materialized-view.cjs.map +1 -1
- package/pg-core/async/refresh-materialized-view.js +9 -1
- package/pg-core/async/refresh-materialized-view.js.map +1 -1
- package/pg-core/async/select.cjs +13 -4
- package/pg-core/async/select.cjs.map +1 -1
- package/pg-core/async/select.js +13 -4
- package/pg-core/async/select.js.map +1 -1
- package/pg-core/async/session.cjs +22 -46
- package/pg-core/async/session.cjs.map +1 -1
- package/pg-core/async/session.d.cts +31 -25
- package/pg-core/async/session.d.ts +32 -26
- package/pg-core/async/session.js +23 -47
- package/pg-core/async/session.js.map +1 -1
- package/pg-core/async/update.cjs +15 -11
- package/pg-core/async/update.cjs.map +1 -1
- package/pg-core/async/update.js +15 -11
- package/pg-core/async/update.js.map +1 -1
- package/pg-core/columns/bigint.cjs +9 -10
- package/pg-core/columns/bigint.cjs.map +1 -1
- package/pg-core/columns/bigint.d.cts +3 -2
- package/pg-core/columns/bigint.d.ts +3 -2
- package/pg-core/columns/bigint.js +9 -10
- 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 +2 -1
- package/pg-core/columns/bigserial.d.ts +2 -1
- package/pg-core/columns/bigserial.js +6 -6
- package/pg-core/columns/bigserial.js.map +1 -1
- package/pg-core/columns/boolean.cjs +0 -2
- package/pg-core/columns/boolean.cjs.map +1 -1
- package/pg-core/columns/boolean.js +0 -2
- package/pg-core/columns/boolean.js.map +1 -1
- package/pg-core/columns/bytea.cjs +8 -2
- package/pg-core/columns/bytea.cjs.map +1 -1
- package/pg-core/columns/bytea.d.cts +1 -0
- package/pg-core/columns/bytea.d.ts +1 -0
- package/pg-core/columns/bytea.js +8 -2
- package/pg-core/columns/bytea.js.map +1 -1
- package/pg-core/columns/char.cjs +0 -2
- package/pg-core/columns/char.cjs.map +1 -1
- package/pg-core/columns/char.js +0 -2
- package/pg-core/columns/char.js.map +1 -1
- package/pg-core/columns/cidr.cjs +0 -2
- package/pg-core/columns/cidr.cjs.map +1 -1
- package/pg-core/columns/cidr.js +0 -2
- package/pg-core/columns/cidr.js.map +1 -1
- package/pg-core/columns/common.cjs +9 -11
- package/pg-core/columns/common.cjs.map +1 -1
- package/pg-core/columns/common.d.cts +39 -34
- package/pg-core/columns/common.d.ts +39 -34
- package/pg-core/columns/common.js +9 -11
- package/pg-core/columns/common.js.map +1 -1
- package/pg-core/columns/custom.cjs +46 -16
- package/pg-core/columns/custom.cjs.map +1 -1
- package/pg-core/columns/custom.d.cts +8 -17
- package/pg-core/columns/custom.d.ts +8 -17
- package/pg-core/columns/custom.js +46 -16
- package/pg-core/columns/custom.js.map +1 -1
- package/pg-core/columns/date.cjs +12 -11
- package/pg-core/columns/date.cjs.map +1 -1
- package/pg-core/columns/date.d.cts +4 -3
- package/pg-core/columns/date.d.ts +4 -3
- package/pg-core/columns/date.js +12 -11
- package/pg-core/columns/date.js.map +1 -1
- package/pg-core/columns/double-precision.cjs +4 -2
- package/pg-core/columns/double-precision.cjs.map +1 -1
- package/pg-core/columns/double-precision.d.cts +1 -0
- package/pg-core/columns/double-precision.d.ts +1 -0
- package/pg-core/columns/double-precision.js +4 -2
- package/pg-core/columns/double-precision.js.map +1 -1
- package/pg-core/columns/enum.cjs +0 -4
- package/pg-core/columns/enum.cjs.map +1 -1
- package/pg-core/columns/enum.js +0 -4
- 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 +0 -2
- package/pg-core/columns/inet.cjs.map +1 -1
- package/pg-core/columns/inet.js +0 -2
- package/pg-core/columns/inet.js.map +1 -1
- package/pg-core/columns/integer.cjs +4 -2
- package/pg-core/columns/integer.cjs.map +1 -1
- package/pg-core/columns/integer.d.cts +1 -0
- package/pg-core/columns/integer.d.ts +1 -0
- package/pg-core/columns/integer.js +4 -2
- package/pg-core/columns/integer.js.map +1 -1
- package/pg-core/columns/interval.cjs +0 -2
- package/pg-core/columns/interval.cjs.map +1 -1
- package/pg-core/columns/interval.js +0 -2
- package/pg-core/columns/interval.js.map +1 -1
- package/pg-core/columns/json.cjs +11 -2
- package/pg-core/columns/json.cjs.map +1 -1
- package/pg-core/columns/json.d.cts +2 -0
- package/pg-core/columns/json.d.ts +2 -0
- package/pg-core/columns/json.js +11 -2
- package/pg-core/columns/json.js.map +1 -1
- package/pg-core/columns/jsonb.cjs +11 -2
- package/pg-core/columns/jsonb.cjs.map +1 -1
- package/pg-core/columns/jsonb.d.cts +2 -0
- package/pg-core/columns/jsonb.d.ts +2 -0
- package/pg-core/columns/jsonb.js +11 -2
- package/pg-core/columns/jsonb.js.map +1 -1
- package/pg-core/columns/line.cjs +8 -12
- 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 +8 -12
- package/pg-core/columns/line.js.map +1 -1
- package/pg-core/columns/macaddr.cjs +0 -2
- package/pg-core/columns/macaddr.cjs.map +1 -1
- package/pg-core/columns/macaddr.js +0 -2
- package/pg-core/columns/macaddr.js.map +1 -1
- package/pg-core/columns/macaddr8.cjs +0 -2
- package/pg-core/columns/macaddr8.cjs.map +1 -1
- package/pg-core/columns/macaddr8.js +0 -2
- package/pg-core/columns/macaddr8.js.map +1 -1
- package/pg-core/columns/numeric.cjs +15 -12
- package/pg-core/columns/numeric.cjs.map +1 -1
- package/pg-core/columns/numeric.d.cts +5 -4
- package/pg-core/columns/numeric.d.ts +5 -4
- package/pg-core/columns/numeric.js +15 -12
- package/pg-core/columns/numeric.js.map +1 -1
- package/pg-core/columns/point.cjs +21 -19
- package/pg-core/columns/point.cjs.map +1 -1
- package/pg-core/columns/point.d.cts +11 -5
- package/pg-core/columns/point.d.ts +11 -5
- package/pg-core/columns/point.js +21 -19
- package/pg-core/columns/point.js.map +1 -1
- package/pg-core/columns/postgis_extension/geometry.cjs +9 -12
- 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 +9 -12
- package/pg-core/columns/postgis_extension/geometry.js.map +1 -1
- package/pg-core/columns/real.cjs +4 -2
- package/pg-core/columns/real.cjs.map +1 -1
- package/pg-core/columns/real.d.cts +1 -0
- package/pg-core/columns/real.d.ts +1 -0
- package/pg-core/columns/real.js +4 -2
- package/pg-core/columns/real.js.map +1 -1
- package/pg-core/columns/serial.cjs +0 -2
- package/pg-core/columns/serial.cjs.map +1 -1
- package/pg-core/columns/serial.js +0 -2
- package/pg-core/columns/serial.js.map +1 -1
- package/pg-core/columns/smallint.cjs +4 -2
- package/pg-core/columns/smallint.cjs.map +1 -1
- package/pg-core/columns/smallint.d.cts +1 -0
- package/pg-core/columns/smallint.d.ts +1 -0
- package/pg-core/columns/smallint.js +4 -2
- package/pg-core/columns/smallint.js.map +1 -1
- package/pg-core/columns/smallserial.cjs +0 -2
- package/pg-core/columns/smallserial.cjs.map +1 -1
- package/pg-core/columns/smallserial.js +0 -2
- package/pg-core/columns/smallserial.js.map +1 -1
- package/pg-core/columns/text.cjs +0 -2
- package/pg-core/columns/text.cjs.map +1 -1
- package/pg-core/columns/text.js +0 -2
- package/pg-core/columns/text.js.map +1 -1
- package/pg-core/columns/time.cjs +0 -2
- package/pg-core/columns/time.cjs.map +1 -1
- package/pg-core/columns/time.js +0 -2
- package/pg-core/columns/time.js.map +1 -1
- package/pg-core/columns/timestamp.cjs +14 -13
- package/pg-core/columns/timestamp.cjs.map +1 -1
- package/pg-core/columns/timestamp.d.cts +4 -3
- package/pg-core/columns/timestamp.d.ts +4 -3
- package/pg-core/columns/timestamp.js +14 -13
- package/pg-core/columns/timestamp.js.map +1 -1
- package/pg-core/columns/uuid.cjs +0 -2
- package/pg-core/columns/uuid.cjs.map +1 -1
- package/pg-core/columns/uuid.js +0 -2
- package/pg-core/columns/uuid.js.map +1 -1
- package/pg-core/columns/varchar.cjs +0 -2
- package/pg-core/columns/varchar.cjs.map +1 -1
- package/pg-core/columns/varchar.js +0 -2
- package/pg-core/columns/varchar.js.map +1 -1
- package/pg-core/columns/vector_extension/bit.cjs +0 -2
- package/pg-core/columns/vector_extension/bit.cjs.map +1 -1
- package/pg-core/columns/vector_extension/bit.js +0 -2
- package/pg-core/columns/vector_extension/bit.js.map +1 -1
- package/pg-core/columns/vector_extension/halfvec.cjs +4 -6
- 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 +4 -6
- package/pg-core/columns/vector_extension/halfvec.js.map +1 -1
- package/pg-core/columns/vector_extension/sparsevec.cjs +0 -2
- package/pg-core/columns/vector_extension/sparsevec.cjs.map +1 -1
- package/pg-core/columns/vector_extension/sparsevec.js +0 -2
- package/pg-core/columns/vector_extension/sparsevec.js.map +1 -1
- package/pg-core/columns/vector_extension/vector.cjs +4 -6
- 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 +4 -6
- package/pg-core/columns/vector_extension/vector.js.map +1 -1
- package/pg-core/dialect.cjs +217 -52
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.d.cts +30 -19
- package/pg-core/dialect.d.ts +31 -20
- package/pg-core/dialect.js +221 -57
- 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 +20 -14
- package/pg-core/effect/db.cjs.map +1 -1
- package/pg-core/effect/db.d.cts +11 -7
- package/pg-core/effect/db.d.ts +13 -9
- package/pg-core/effect/db.js +20 -14
- package/pg-core/effect/db.js.map +1 -1
- package/pg-core/effect/delete.cjs +6 -8
- 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 +6 -8
- 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 +5 -7
- 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 +5 -7
- package/pg-core/effect/insert.js.map +1 -1
- package/pg-core/effect/query.cjs +6 -7
- 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 +6 -7
- package/pg-core/effect/query.js.map +1 -1
- package/pg-core/effect/refresh-materialized-view.cjs +2 -1
- 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 +2 -1
- package/pg-core/effect/refresh-materialized-view.js.map +1 -1
- package/pg-core/effect/select.cjs +5 -3
- 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 +5 -3
- package/pg-core/effect/select.js.map +1 -1
- package/pg-core/effect/session.cjs +19 -30
- package/pg-core/effect/session.cjs.map +1 -1
- package/pg-core/effect/session.d.cts +28 -24
- package/pg-core/effect/session.d.ts +29 -25
- package/pg-core/effect/session.js +20 -31
- 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/_query.cjs +101 -0
- package/pg-core/query-builders/_query.cjs.map +1 -0
- package/pg-core/query-builders/_query.d.cts +55 -0
- package/pg-core/query-builders/_query.d.ts +55 -0
- package/pg-core/query-builders/_query.js +97 -0
- package/pg-core/query-builders/_query.js.map +1 -0
- 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 +1 -0
- package/pg-core/query-builders/query.cjs.map +1 -1
- package/pg-core/query-builders/query.d.cts +1 -2
- package/pg-core/query-builders/query.d.ts +1 -2
- package/pg-core/query-builders/query.js +1 -0
- package/pg-core/query-builders/query.js.map +1 -1
- package/pg-core/query-builders/raw.cjs +4 -0
- package/pg-core/query-builders/raw.cjs.map +1 -1
- package/pg-core/query-builders/raw.js +4 -0
- 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 +5 -3
- package/pg-core/session.cjs.map +1 -1
- package/pg-core/session.d.cts +7 -4
- package/pg-core/session.d.ts +7 -4
- package/pg-core/session.js +5 -3
- 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/{array.cjs → utils/array.cjs} +1 -1
- package/pg-core/utils/array.cjs.map +1 -0
- package/pg-core/{array.d.cts → utils/array.d.cts} +1 -1
- package/pg-core/{array.d.ts → utils/array.d.ts} +1 -1
- package/pg-core/{array.js → utils/array.js} +1 -1
- package/pg-core/utils/array.js.map +1 -0
- package/pg-core/utils/index.cjs +6 -0
- package/pg-core/utils/index.d.cts +2 -0
- package/pg-core/utils/index.d.ts +2 -0
- package/pg-core/utils/index.js +3 -0
- package/pg-core/utils.cjs +2 -2
- package/pg-core/utils.cjs.map +1 -1
- package/pg-core/utils.d.cts +1 -7
- package/pg-core/utils.d.ts +1 -7
- 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 +15 -10
- package/pg-proxy/driver.cjs.map +1 -1
- package/pg-proxy/driver.d.cts +3 -6
- package/pg-proxy/driver.d.ts +4 -7
- package/pg-proxy/driver.js +14 -10
- package/pg-proxy/driver.js.map +1 -1
- package/pg-proxy/index.cjs +2 -0
- 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 +84 -8
- package/pg-proxy/session.cjs.map +1 -1
- package/pg-proxy/session.d.cts +32 -9
- package/pg-proxy/session.d.ts +33 -10
- package/pg-proxy/session.js +84 -10
- package/pg-proxy/session.js.map +1 -1
- package/pglite/driver.cjs +33 -71
- package/pglite/driver.cjs.map +1 -1
- package/pglite/driver.d.cts +17 -12
- package/pglite/driver.d.ts +19 -14
- package/pglite/driver.js +32 -71
- package/pglite/driver.js.map +1 -1
- package/pglite/index.cjs +3 -2
- 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 +86 -25
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.d.cts +30 -9
- package/pglite/session.d.ts +32 -11
- package/pglite/session.js +87 -27
- package/pglite/session.js.map +1 -1
- package/planetscale-serverless/driver.cjs +2 -3
- package/planetscale-serverless/driver.cjs.map +1 -1
- package/planetscale-serverless/driver.d.cts +0 -1
- package/planetscale-serverless/driver.d.ts +0 -1
- package/planetscale-serverless/driver.js +2 -3
- package/planetscale-serverless/driver.js.map +1 -1
- package/planetscale-serverless/session.cjs +20 -27
- package/planetscale-serverless/session.cjs.map +1 -1
- package/planetscale-serverless/session.d.cts +6 -12
- package/planetscale-serverless/session.d.ts +8 -14
- package/planetscale-serverless/session.js +21 -28
- package/planetscale-serverless/session.js.map +1 -1
- package/postgres-js/driver.cjs +19 -124
- package/postgres-js/driver.cjs.map +1 -1
- package/postgres-js/driver.d.cts +6 -10
- package/postgres-js/driver.d.ts +7 -11
- package/postgres-js/driver.js +19 -124
- 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 +112 -17
- package/postgres-js/session.cjs.map +1 -1
- package/postgres-js/session.d.cts +31 -10
- package/postgres-js/session.d.ts +32 -11
- package/postgres-js/session.js +112 -18
- 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 +1 -2
- package/prisma/mysql/session.cjs.map +1 -1
- package/prisma/mysql/session.d.cts +0 -1
- package/prisma/mysql/session.d.ts +1 -2
- package/prisma/mysql/session.js +1 -2
- package/prisma/mysql/session.js.map +1 -1
- package/prisma/pg/driver.cjs +3 -9
- package/prisma/pg/driver.cjs.map +1 -1
- package/prisma/pg/driver.d.cts +3 -7
- package/prisma/pg/driver.d.ts +3 -7
- package/prisma/pg/driver.js +4 -9
- 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 +25 -1
- package/prisma/pg/session.cjs.map +1 -1
- package/prisma/pg/session.d.cts +15 -3
- package/prisma/pg/session.d.ts +15 -3
- package/prisma/pg/session.js +25 -2
- package/prisma/pg/session.js.map +1 -1
- package/prisma/sqlite/session.cjs +3 -0
- package/prisma/sqlite/session.cjs.map +1 -1
- package/prisma/sqlite/session.d.cts +1 -0
- package/prisma/sqlite/session.d.ts +2 -1
- package/prisma/sqlite/session.js +3 -0
- package/prisma/sqlite/session.js.map +1 -1
- package/relations.cjs +24 -85
- package/relations.cjs.map +1 -1
- package/relations.d.cts +16 -41
- package/relations.d.ts +16 -41
- package/relations.js +25 -84
- 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 +2 -4
- package/singlestore/driver.cjs.map +1 -1
- package/singlestore/driver.d.cts +1 -2
- package/singlestore/driver.d.ts +3 -4
- package/singlestore/driver.js +2 -4
- package/singlestore/driver.js.map +1 -1
- package/singlestore/session.cjs +7 -17
- package/singlestore/session.cjs.map +1 -1
- package/singlestore/session.d.cts +4 -8
- package/singlestore/session.d.ts +6 -10
- package/singlestore/session.js +8 -18
- 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 +5 -13
- 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 +5 -13
- 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 +2 -5
- package/singlestore-proxy/driver.cjs.map +1 -1
- package/singlestore-proxy/driver.js +2 -5
- package/singlestore-proxy/driver.js.map +1 -1
- package/singlestore-proxy/session.cjs +6 -11
- package/singlestore-proxy/session.cjs.map +1 -1
- package/singlestore-proxy/session.d.cts +4 -9
- package/singlestore-proxy/session.d.ts +5 -10
- package/singlestore-proxy/session.js +7 -12
- package/singlestore-proxy/session.js.map +1 -1
- package/sql/index.cjs +0 -1
- package/sql/index.d.cts +2 -2
- package/sql/index.d.ts +2 -2
- package/sql/index.js +2 -2
- package/sql/sql.cjs +11 -32
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.d.cts +5 -15
- package/sql/sql.d.ts +5 -15
- package/sql/sql.js +12 -32
- package/sql/sql.js.map +1 -1
- package/sql-js/driver.cjs +2 -5
- package/sql-js/driver.cjs.map +1 -1
- package/sql-js/driver.d.ts +1 -1
- package/sql-js/driver.js +2 -5
- 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 +6 -10
- package/sql-js/session.d.ts +6 -10
- package/sql-js/session.js +15 -15
- package/sql-js/session.js.map +1 -1
- package/sqlite-cloud/driver.cjs +2 -3
- package/sqlite-cloud/driver.cjs.map +1 -1
- package/sqlite-cloud/driver.d.ts +1 -1
- package/sqlite-cloud/driver.js +2 -3
- package/sqlite-cloud/driver.js.map +1 -1
- package/sqlite-cloud/session.cjs +20 -21
- package/sqlite-cloud/session.cjs.map +1 -1
- package/sqlite-cloud/session.d.cts +6 -9
- package/sqlite-cloud/session.d.ts +7 -10
- package/sqlite-cloud/session.js +21 -22
- 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 +5 -13
- 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 +5 -13
- package/sqlite-core/query-builders/query.js.map +1 -1
- package/sqlite-core/query-builders/raw.cjs +4 -0
- package/sqlite-core/query-builders/raw.cjs.map +1 -1
- package/sqlite-core/query-builders/raw.js +4 -0
- 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 +2 -3
- package/sqlite-proxy/driver.cjs.map +1 -1
- package/sqlite-proxy/driver.d.ts +1 -1
- package/sqlite-proxy/driver.js +2 -3
- package/sqlite-proxy/driver.js.map +1 -1
- package/sqlite-proxy/session.cjs +17 -20
- package/sqlite-proxy/session.cjs.map +1 -1
- package/sqlite-proxy/session.d.cts +7 -11
- package/sqlite-proxy/session.d.ts +8 -12
- package/sqlite-proxy/session.js +18 -21
- 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 +2 -3
- package/tidb-serverless/driver.cjs.map +1 -1
- package/tidb-serverless/driver.d.cts +0 -1
- package/tidb-serverless/driver.d.ts +0 -1
- package/tidb-serverless/driver.js +2 -3
- package/tidb-serverless/driver.js.map +1 -1
- package/tidb-serverless/session.cjs +37 -25
- package/tidb-serverless/session.cjs.map +1 -1
- package/tidb-serverless/session.d.cts +4 -10
- package/tidb-serverless/session.d.ts +6 -12
- package/tidb-serverless/session.js +38 -26
- package/tidb-serverless/session.js.map +1 -1
- package/tursodatabase/driver-core.cjs +2 -3
- package/tursodatabase/driver-core.cjs.map +1 -1
- package/tursodatabase/driver-core.d.ts +1 -1
- package/tursodatabase/driver-core.js +2 -3
- package/tursodatabase/driver-core.js.map +1 -1
- package/tursodatabase/session.cjs +19 -20
- package/tursodatabase/session.cjs.map +1 -1
- package/tursodatabase/session.d.cts +6 -9
- package/tursodatabase/session.d.ts +7 -10
- package/tursodatabase/session.js +20 -21
- 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 +8 -3
- 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 +8 -3
- package/up-migrations/pg.js.map +1 -1
- package/up-migrations/sqlite.d.ts +2 -2
- package/utils.cjs +7 -129
- package/utils.cjs.map +1 -1
- package/utils.d.cts +3 -10
- package/utils.d.ts +3 -10
- package/utils.js +8 -127
- package/utils.js.map +1 -1
- package/vercel-postgres/driver.cjs +32 -14
- package/vercel-postgres/driver.cjs.map +1 -1
- package/vercel-postgres/driver.d.cts +17 -12
- package/vercel-postgres/driver.d.ts +18 -13
- package/vercel-postgres/driver.js +31 -14
- package/vercel-postgres/driver.js.map +1 -1
- package/vercel-postgres/index.cjs +3 -2
- 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 +110 -32
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.d.cts +32 -9
- package/vercel-postgres/session.d.ts +33 -10
- package/vercel-postgres/session.js +111 -34
- package/vercel-postgres/session.js.map +1 -1
- package/xata-http/driver.cjs +31 -91
- package/xata-http/driver.cjs.map +1 -1
- package/xata-http/driver.d.cts +16 -10
- package/xata-http/driver.d.ts +17 -11
- package/xata-http/driver.js +30 -91
- package/xata-http/driver.js.map +1 -1
- package/xata-http/index.cjs +4 -2
- 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 +110 -24
- package/xata-http/session.cjs.map +1 -1
- package/xata-http/session.d.cts +33 -7
- package/xata-http/session.d.ts +34 -8
- package/xata-http/session.js +110 -26
- package/xata-http/session.js.map +1 -1
- package/codecs.cjs +0 -77
- package/codecs.cjs.map +0 -1
- package/codecs.d.cts +0 -68
- package/codecs.d.ts +0 -68
- package/codecs.js +0 -74
- package/codecs.js.map +0 -1
- package/pg-core/array.cjs.map +0 -1
- package/pg-core/array.js.map +0 -1
- package/pg-core/codecs.cjs +0 -156
- package/pg-core/codecs.cjs.map +0 -1
- package/pg-core/codecs.d.cts +0 -27
- package/pg-core/codecs.d.ts +0 -27
- package/pg-core/codecs.js +0 -148
- package/pg-core/codecs.js.map +0 -1
|
@@ -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>;\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\
|
|
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, 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, 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\tall: unknown;\n\t\t\tvalues: unknown;\n\t\t}>(\n\t\t\tthis.build(),\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\ttrue,\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,aAKnB,KAAK,OAAO,EACZ,QACA,QACA,OACC,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, 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, 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, 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, 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(), void 0, void 0, true, (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>;\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\
|
|
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, 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, 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\tall: unknown;\n\t\t\tvalues: unknown;\n\t\t}>(\n\t\t\tthis.build(),\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\ttrue,\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,aAKnB,KAAK,OAAO,EACZ,QACA,QACA,OACC,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,17 +2,16 @@ 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_delete = require('./delete.cjs');
|
|
6
|
-
const require_pg_core_effect_query = require('./query.cjs');
|
|
7
5
|
const require_pg_core_effect_raw = require('./raw.cjs');
|
|
8
6
|
const require_pg_core_effect_refresh_materialized_view = require('./refresh-materialized-view.cjs');
|
|
7
|
+
const require_pg_core_effect_delete = require('./delete.cjs');
|
|
8
|
+
const require_pg_core_effect_query = require('./query.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");
|
|
13
12
|
let __sql_sql_ts = require("../../sql/sql.cjs");
|
|
14
|
-
let __selection_proxy_ts = require("../../selection-proxy.cjs");
|
|
15
13
|
let effect = require("effect");
|
|
14
|
+
let __selection_proxy_ts = require("../../selection-proxy.cjs");
|
|
16
15
|
let __pg_core_effect_count_ts = require("./count.cjs");
|
|
17
16
|
let __pg_core_effect_insert_ts = require("./insert.cjs");
|
|
18
17
|
let __pg_core_effect_select_ts = require("./select.cjs");
|
|
@@ -23,10 +22,19 @@ let __pg_core_query_builders_query_ts = require("../query-builders/query.cjs");
|
|
|
23
22
|
var PgEffectDatabase = class {
|
|
24
23
|
static [__entity_ts.entityKind] = "EffectPgDatabase";
|
|
25
24
|
query;
|
|
26
|
-
constructor(dialect, session, relations, parseRqbJson = false) {
|
|
25
|
+
constructor(dialect, session, relations, schema, parseRqbJson = false) {
|
|
27
26
|
this.dialect = dialect;
|
|
28
27
|
this.session = session;
|
|
29
|
-
this._ = {
|
|
28
|
+
this._ = schema ? {
|
|
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: {},
|
|
30
38
|
relations,
|
|
31
39
|
session
|
|
32
40
|
};
|
|
@@ -67,11 +75,9 @@ var PgEffectDatabase = class {
|
|
|
67
75
|
* ```
|
|
68
76
|
*/
|
|
69
77
|
$with = (alias, selection) => {
|
|
78
|
+
const self = this;
|
|
70
79
|
const as = (qb) => {
|
|
71
|
-
if (typeof qb === "function") qb = qb(new require_pg_core_query_builders_query_builder.QueryBuilder(
|
|
72
|
-
casing: this.dialect.casing,
|
|
73
|
-
codecs: __codecs_ts.noopCodecs
|
|
74
|
-
})));
|
|
80
|
+
if (typeof qb === "function") qb = qb(new require_pg_core_query_builders_query_builder.QueryBuilder(self.dialect));
|
|
75
81
|
return new Proxy(new __subquery_ts.WithSubquery(qb.getSQL(), selection ?? ("getSelectedFields" in qb ? qb.getSelectedFields() ?? {} : {}), alias, true), new __selection_proxy_ts.SelectionProxyHandler({
|
|
76
82
|
alias,
|
|
77
83
|
sqlAliasedBehavior: "alias",
|
|
@@ -342,10 +348,12 @@ var PgEffectDatabase = class {
|
|
|
342
348
|
execute(query) {
|
|
343
349
|
const sequel = typeof query === "string" ? __sql_sql_ts.sql.raw(query) : query.getSQL();
|
|
344
350
|
const builtQuery = this.dialect.sqlToQuery(sequel);
|
|
345
|
-
const prepared = this.session.prepareQuery(builtQuery,
|
|
351
|
+
const prepared = this.session.prepareQuery(builtQuery, void 0, void 0, false);
|
|
346
352
|
return new require_pg_core_effect_raw.PgEffectRaw(() => prepared.execute(), sequel, builtQuery, (result) => prepared.mapResult(result, true));
|
|
347
353
|
}
|
|
348
|
-
transaction
|
|
354
|
+
transaction(transaction) {
|
|
355
|
+
return this.session.transaction(transaction);
|
|
356
|
+
}
|
|
349
357
|
};
|
|
350
358
|
const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(Math.random() * replicas.length)]) => {
|
|
351
359
|
const select = (...args) => getReplica(replicas).select(...args);
|
|
@@ -358,7 +366,6 @@ const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(
|
|
|
358
366
|
const insert = (...args) => primary.insert(...args);
|
|
359
367
|
const $delete = (...args) => primary.delete(...args);
|
|
360
368
|
const execute = (...args) => primary.execute(...args);
|
|
361
|
-
const transaction = (...args) => primary.transaction(...args);
|
|
362
369
|
const refreshMaterializedView = (...args) => primary.refreshMaterializedView(...args);
|
|
363
370
|
return {
|
|
364
371
|
...primary,
|
|
@@ -366,7 +373,6 @@ const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(
|
|
|
366
373
|
insert,
|
|
367
374
|
delete: $delete,
|
|
368
375
|
execute,
|
|
369
|
-
transaction,
|
|
370
376
|
refreshMaterializedView,
|
|
371
377
|
$primary: primary,
|
|
372
378
|
$replicas: replicas,
|
|
@@ -1 +1 @@
|
|
|
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\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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"}
|
|
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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"}
|
package/pg-core/effect/db.d.cts
CHANGED
|
@@ -13,33 +13,37 @@ 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";
|
|
16
17
|
import { AnyRelations, EmptyRelations } from "../../relations.cjs";
|
|
17
18
|
import { PgTable } from "../table.cjs";
|
|
18
19
|
import { PgViewBase } from "../view-base.cjs";
|
|
19
20
|
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 * as _effect_sql_SqlError0 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";
|
|
28
29
|
import { RelationalQueryBuilder } from "../query-builders/query.cjs";
|
|
29
30
|
|
|
30
31
|
//#region src/pg-core/effect/db.d.ts
|
|
31
|
-
declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResult extends PgQueryResultHKT, TRelations extends AnyRelations = EmptyRelations
|
|
32
|
+
declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResult extends PgQueryResultHKT, TFullSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations, TSchema extends V1.TablesRelationalConfig = V1.ExtractTablesWithRelations<TFullSchema>> {
|
|
32
33
|
static readonly [entityKind]: string;
|
|
33
34
|
readonly _: {
|
|
35
|
+
readonly schema: TSchema | undefined;
|
|
36
|
+
readonly fullSchema: TFullSchema;
|
|
37
|
+
readonly tableNamesMap: Record<string, string>;
|
|
34
38
|
readonly relations: TRelations;
|
|
35
|
-
readonly session: PgEffectSession<TEffectHKT, TQueryResult, TRelations>;
|
|
39
|
+
readonly session: PgEffectSession<TEffectHKT, TQueryResult, TFullSchema, TRelations, TSchema>;
|
|
36
40
|
};
|
|
37
41
|
query: { [K in keyof TRelations]: RelationalQueryBuilder<TRelations, TRelations[K], PgEffectRelationalQueryHKT<TEffectHKT>> };
|
|
38
42
|
constructor(/** @internal */
|
|
39
43
|
|
|
40
44
|
dialect: PgDialect, /** @internal */
|
|
41
45
|
|
|
42
|
-
session: PgEffectSession<TEffectHKT, any, any>, relations: TRelations, parseRqbJson?: boolean);
|
|
46
|
+
session: PgEffectSession<TEffectHKT, any, any, any, any>, relations: TRelations, schema: V1.RelationalSchemaConfig<TSchema> | undefined, parseRqbJson?: boolean);
|
|
43
47
|
/**
|
|
44
48
|
* Creates a subquery that defines a temporary named result set as a CTE.
|
|
45
49
|
*
|
|
@@ -284,13 +288,13 @@ declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResu
|
|
|
284
288
|
delete<TTable extends PgTable>(table: TTable): PgEffectDeleteBase<TTable, TQueryResult, undefined, undefined, false, never, TEffectHKT>;
|
|
285
289
|
refreshMaterializedView<TView extends PgMaterializedView>(view: TView): PgEffectRefreshMaterializedView<TQueryResult, TEffectHKT>;
|
|
286
290
|
execute<TRow extends Record<string, unknown>>(query: SQLWrapper | string): PgEffectRaw<PgQueryResultKind<TQueryResult, TRow>, TEffectHKT>;
|
|
287
|
-
transaction
|
|
291
|
+
transaction<A, E, R>(transaction: (tx: PgEffectTransaction<TEffectHKT, TQueryResult, TFullSchema, TRelations, TSchema>) => Effect.Effect<A, E, R>): Effect.Effect<A, E | _effect_sql_SqlError0.SqlError, R>;
|
|
288
292
|
}
|
|
289
293
|
type PgEffectWithReplicas<Q> = Q & {
|
|
290
294
|
$primary: Q;
|
|
291
295
|
$replicas: Q[];
|
|
292
296
|
};
|
|
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>;
|
|
297
|
+
declare const withReplicas: <TEffectHKT extends QueryEffectHKTBase, HKT extends PgQueryResultHKT, TFullSchema extends Record<string, unknown>, TRelations extends AnyRelations, TSchema extends V1.TablesRelationalConfig, Q extends PgEffectDatabase<TEffectHKT, HKT, TFullSchema, TRelations, TSchema extends Record<string, unknown> ? V1.ExtractTablesWithRelations<TFullSchema> : TSchema>>(primary: Q, replicas: [Q, ...Q[]], getReplica?: (replicas: Q[]) => Q) => PgEffectWithReplicas<Q>;
|
|
294
298
|
//#endregion
|
|
295
299
|
export { PgEffectDatabase, PgEffectWithReplicas, withReplicas };
|
|
296
300
|
//# sourceMappingURL=db.d.cts.map
|
package/pg-core/effect/db.d.ts
CHANGED
|
@@ -13,33 +13,37 @@ 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 * as V1 from "../../_relations.js";
|
|
17
17
|
import { PgDialect } from "../dialect.js";
|
|
18
|
-
import { EffectCache } from "../../cache/core/cache-effect.js";
|
|
19
18
|
import { Effect } from "effect";
|
|
19
|
+
import { EffectCache } from "../../cache/core/cache-effect.js";
|
|
20
|
+
import { AnyRelations, EmptyRelations } from "../../relations.js";
|
|
20
21
|
import { PgTable } from "../table.js";
|
|
21
22
|
import { PgViewBase } from "../view-base.js";
|
|
23
|
+
import { QueryEffectHKTBase } from "../../effect-core/query-effect.js";
|
|
22
24
|
import { PgEffectCountBuilder } from "./count.js";
|
|
23
25
|
import { PgEffectInsertHKT } from "./insert.js";
|
|
24
26
|
import { PgEffectSelectBuilder } from "./select.js";
|
|
25
27
|
import { PgInsertBuilder } from "../query-builders/insert.js";
|
|
26
28
|
import { RelationalQueryBuilder } from "../query-builders/query.js";
|
|
27
|
-
import
|
|
28
|
-
import { SqlError } from "@effect/sql/SqlError";
|
|
29
|
+
import * as _effect_sql_SqlError0 from "@effect/sql/SqlError";
|
|
29
30
|
|
|
30
31
|
//#region src/pg-core/effect/db.d.ts
|
|
31
|
-
declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResult extends PgQueryResultHKT, TRelations extends AnyRelations = EmptyRelations
|
|
32
|
+
declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResult extends PgQueryResultHKT, TFullSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations, TSchema extends V1.TablesRelationalConfig = V1.ExtractTablesWithRelations<TFullSchema>> {
|
|
32
33
|
static readonly [entityKind]: string;
|
|
33
34
|
readonly _: {
|
|
35
|
+
readonly schema: TSchema | undefined;
|
|
36
|
+
readonly fullSchema: TFullSchema;
|
|
37
|
+
readonly tableNamesMap: Record<string, string>;
|
|
34
38
|
readonly relations: TRelations;
|
|
35
|
-
readonly session: PgEffectSession<TEffectHKT, TQueryResult, TRelations>;
|
|
39
|
+
readonly session: PgEffectSession<TEffectHKT, TQueryResult, TFullSchema, TRelations, TSchema>;
|
|
36
40
|
};
|
|
37
41
|
query: { [K in keyof TRelations]: RelationalQueryBuilder<TRelations, TRelations[K], PgEffectRelationalQueryHKT<TEffectHKT>> };
|
|
38
42
|
constructor(/** @internal */
|
|
39
43
|
|
|
40
44
|
dialect: PgDialect, /** @internal */
|
|
41
45
|
|
|
42
|
-
session: PgEffectSession<TEffectHKT, any, any>, relations: TRelations, parseRqbJson?: boolean);
|
|
46
|
+
session: PgEffectSession<TEffectHKT, any, any, any, any>, relations: TRelations, schema: V1.RelationalSchemaConfig<TSchema> | undefined, parseRqbJson?: boolean);
|
|
43
47
|
/**
|
|
44
48
|
* Creates a subquery that defines a temporary named result set as a CTE.
|
|
45
49
|
*
|
|
@@ -284,13 +288,13 @@ declare class PgEffectDatabase<TEffectHKT extends QueryEffectHKTBase, TQueryResu
|
|
|
284
288
|
delete<TTable extends PgTable>(table: TTable): PgEffectDeleteBase<TTable, TQueryResult, undefined, undefined, false, never, TEffectHKT>;
|
|
285
289
|
refreshMaterializedView<TView extends PgMaterializedView>(view: TView): PgEffectRefreshMaterializedView<TQueryResult, TEffectHKT>;
|
|
286
290
|
execute<TRow extends Record<string, unknown>>(query: SQLWrapper | string): PgEffectRaw<PgQueryResultKind<TQueryResult, TRow>, TEffectHKT>;
|
|
287
|
-
transaction
|
|
291
|
+
transaction<A, E, R>(transaction: (tx: PgEffectTransaction<TEffectHKT, TQueryResult, TFullSchema, TRelations, TSchema>) => Effect.Effect<A, E, R>): Effect.Effect<A, E | _effect_sql_SqlError0.SqlError, R>;
|
|
288
292
|
}
|
|
289
293
|
type PgEffectWithReplicas<Q> = Q & {
|
|
290
294
|
$primary: Q;
|
|
291
295
|
$replicas: Q[];
|
|
292
296
|
};
|
|
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>;
|
|
297
|
+
declare const withReplicas: <TEffectHKT extends QueryEffectHKTBase, HKT extends PgQueryResultHKT, TFullSchema extends Record<string, unknown>, TRelations extends AnyRelations, TSchema extends V1.TablesRelationalConfig, Q extends PgEffectDatabase<TEffectHKT, HKT, TFullSchema, TRelations, TSchema extends Record<string, unknown> ? V1.ExtractTablesWithRelations<TFullSchema> : TSchema>>(primary: Q, replicas: [Q, ...Q[]], getReplica?: (replicas: Q[]) => Q) => PgEffectWithReplicas<Q>;
|
|
294
298
|
//#endregion
|
|
295
299
|
export { PgEffectDatabase, PgEffectWithReplicas, withReplicas };
|
|
296
300
|
//# sourceMappingURL=db.d.ts.map
|
package/pg-core/effect/db.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { QueryBuilder } from "../query-builders/query-builder.js";
|
|
2
2
|
import { PgUpdateBuilder } from "../query-builders/update.js";
|
|
3
|
-
import { PgEffectDeleteBase } from "./delete.js";
|
|
4
|
-
import { PgEffectRelationalQuery } from "./query.js";
|
|
5
3
|
import { PgEffectRaw } from "./raw.js";
|
|
6
4
|
import { PgEffectRefreshMaterializedView } from "./refresh-materialized-view.js";
|
|
5
|
+
import { PgEffectDeleteBase } from "./delete.js";
|
|
6
|
+
import { PgEffectRelationalQuery } from "./query.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";
|
|
11
10
|
import { sql } from "../../sql/sql.js";
|
|
12
|
-
import { SelectionProxyHandler } from "../../selection-proxy.js";
|
|
13
11
|
import { Effect } from "effect";
|
|
12
|
+
import { SelectionProxyHandler } from "../../selection-proxy.js";
|
|
14
13
|
import { PgEffectCountBuilder } from "./count.js";
|
|
15
14
|
import { PgEffectInsertBase } from "./insert.js";
|
|
16
15
|
import { PgEffectSelectBase } from "./select.js";
|
|
@@ -21,10 +20,19 @@ import { RelationalQueryBuilder } from "../query-builders/query.js";
|
|
|
21
20
|
var PgEffectDatabase = class {
|
|
22
21
|
static [entityKind] = "EffectPgDatabase";
|
|
23
22
|
query;
|
|
24
|
-
constructor(dialect, session, relations, parseRqbJson = false) {
|
|
23
|
+
constructor(dialect, session, relations, schema, parseRqbJson = false) {
|
|
25
24
|
this.dialect = dialect;
|
|
26
25
|
this.session = session;
|
|
27
|
-
this._ = {
|
|
26
|
+
this._ = schema ? {
|
|
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: {},
|
|
28
36
|
relations,
|
|
29
37
|
session
|
|
30
38
|
};
|
|
@@ -65,11 +73,9 @@ var PgEffectDatabase = class {
|
|
|
65
73
|
* ```
|
|
66
74
|
*/
|
|
67
75
|
$with = (alias, selection) => {
|
|
76
|
+
const self = this;
|
|
68
77
|
const as = (qb) => {
|
|
69
|
-
if (typeof qb === "function") qb = qb(new QueryBuilder(
|
|
70
|
-
casing: this.dialect.casing,
|
|
71
|
-
codecs: noopCodecs
|
|
72
|
-
})));
|
|
78
|
+
if (typeof qb === "function") qb = qb(new QueryBuilder(self.dialect));
|
|
73
79
|
return new Proxy(new WithSubquery(qb.getSQL(), selection ?? ("getSelectedFields" in qb ? qb.getSelectedFields() ?? {} : {}), alias, true), new SelectionProxyHandler({
|
|
74
80
|
alias,
|
|
75
81
|
sqlAliasedBehavior: "alias",
|
|
@@ -340,10 +346,12 @@ var PgEffectDatabase = class {
|
|
|
340
346
|
execute(query) {
|
|
341
347
|
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
|
|
342
348
|
const builtQuery = this.dialect.sqlToQuery(sequel);
|
|
343
|
-
const prepared = this.session.prepareQuery(builtQuery,
|
|
349
|
+
const prepared = this.session.prepareQuery(builtQuery, void 0, void 0, false);
|
|
344
350
|
return new PgEffectRaw(() => prepared.execute(), sequel, builtQuery, (result) => prepared.mapResult(result, true));
|
|
345
351
|
}
|
|
346
|
-
transaction
|
|
352
|
+
transaction(transaction) {
|
|
353
|
+
return this.session.transaction(transaction);
|
|
354
|
+
}
|
|
347
355
|
};
|
|
348
356
|
const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(Math.random() * replicas.length)]) => {
|
|
349
357
|
const select = (...args) => getReplica(replicas).select(...args);
|
|
@@ -356,7 +364,6 @@ const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(
|
|
|
356
364
|
const insert = (...args) => primary.insert(...args);
|
|
357
365
|
const $delete = (...args) => primary.delete(...args);
|
|
358
366
|
const execute = (...args) => primary.execute(...args);
|
|
359
|
-
const transaction = (...args) => primary.transaction(...args);
|
|
360
367
|
const refreshMaterializedView = (...args) => primary.refreshMaterializedView(...args);
|
|
361
368
|
return {
|
|
362
369
|
...primary,
|
|
@@ -364,7 +371,6 @@ const withReplicas = (primary, replicas, getReplica = () => replicas[Math.floor(
|
|
|
364
371
|
insert,
|
|
365
372
|
delete: $delete,
|
|
366
373
|
execute,
|
|
367
|
-
transaction,
|
|
368
374
|
refreshMaterializedView,
|
|
369
375
|
$primary: primary,
|
|
370
376
|
$replicas: replicas,
|