effect-qb 0.12.3 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +372 -224
  3. package/dist/mysql.js +5037 -4962
  4. package/dist/postgres.js +4978 -4903
  5. package/package.json +8 -1
  6. package/src/internal/column-state.ts +9 -1
  7. package/src/internal/column.ts +30 -17
  8. package/src/internal/expression-ast.ts +11 -0
  9. package/src/internal/expression.ts +2 -0
  10. package/src/internal/query-factory.ts +50 -63
  11. package/src/internal/query.ts +16 -2
  12. package/src/internal/sql-expression-renderer.ts +33 -9
  13. package/src/internal/table-options.ts +2 -1
  14. package/src/internal/table.ts +4 -3
  15. package/src/mysql/column.ts +2 -1
  16. package/src/mysql/executor.ts +20 -17
  17. package/src/mysql/function/aggregate.ts +6 -0
  18. package/src/mysql/function/core.ts +4 -0
  19. package/src/mysql/function/index.ts +19 -0
  20. package/src/mysql/function/json.ts +4 -0
  21. package/src/mysql/function/string.ts +6 -0
  22. package/src/mysql/function/temporal.ts +103 -0
  23. package/src/mysql/function/window.ts +7 -0
  24. package/src/mysql/private/query.ts +13 -0
  25. package/src/mysql/query.ts +1 -26
  26. package/src/mysql.ts +2 -0
  27. package/src/postgres/column.ts +1 -1
  28. package/src/postgres/executor.ts +19 -17
  29. package/src/postgres/function/aggregate.ts +6 -0
  30. package/src/postgres/function/core.ts +4 -0
  31. package/src/postgres/function/index.ts +19 -0
  32. package/src/postgres/function/json.ts +4 -0
  33. package/src/postgres/function/string.ts +6 -0
  34. package/src/postgres/function/temporal.ts +107 -0
  35. package/src/postgres/function/window.ts +7 -0
  36. package/src/postgres/private/query.ts +13 -0
  37. package/src/postgres/query.ts +1 -26
  38. package/src/postgres.ts +2 -0
@@ -0,0 +1,6 @@
1
+ import { mysqlQuery } from "../private/query.js"
2
+
3
+ /** MySQL string functions. */
4
+ export const lower = mysqlQuery.lower
5
+ export const upper = mysqlQuery.upper
6
+ export const concat = mysqlQuery.concat
@@ -0,0 +1,103 @@
1
+ import type * as Schema from "effect/Schema"
2
+
3
+ import type * as Expression from "../../internal/expression.js"
4
+ import type * as ExpressionAst from "../../internal/expression-ast.js"
5
+ import { makeExpression } from "../../internal/query.js"
6
+ import {
7
+ LocalDateStringSchema,
8
+ LocalDateTimeStringSchema,
9
+ LocalTimeStringSchema,
10
+ type LocalDateString,
11
+ type LocalDateTimeString,
12
+ type LocalTimeString
13
+ } from "../../internal/runtime-value.js"
14
+
15
+ type TemporalExpression<
16
+ Runtime,
17
+ Db extends Expression.DbType.Any,
18
+ Name extends string
19
+ > = Expression.Expression<
20
+ Runtime,
21
+ Db,
22
+ "never",
23
+ "mysql",
24
+ "scalar",
25
+ never,
26
+ {},
27
+ "resolved"
28
+ > & {
29
+ readonly [ExpressionAst.TypeId]: ExpressionAst.FunctionCallNode<Name, readonly []>
30
+ }
31
+
32
+ const makeTemporal = <
33
+ Runtime,
34
+ Db extends Expression.DbType.Any,
35
+ Name extends string
36
+ >(
37
+ name: Name,
38
+ dbType: Db,
39
+ runtimeSchema: Schema.Schema<Runtime, any, any>
40
+ ): TemporalExpression<Runtime, Db, Name> =>
41
+ makeExpression({
42
+ runtime: undefined as unknown as Runtime,
43
+ dbType,
44
+ runtimeSchema,
45
+ nullability: "never",
46
+ dialect: "mysql",
47
+ aggregation: "scalar",
48
+ source: undefined as never,
49
+ dependencies: {},
50
+ sourceNullability: "resolved"
51
+ }, {
52
+ kind: "function",
53
+ name,
54
+ args: []
55
+ }) as TemporalExpression<Runtime, Db, Name>
56
+
57
+ /** MySQL current date. */
58
+ export const currentDate = () =>
59
+ makeTemporal(
60
+ "current_date",
61
+ { dialect: "mysql", kind: "date" } as Expression.DbType.MySqlDate,
62
+ LocalDateStringSchema
63
+ )
64
+
65
+ /** MySQL current time. */
66
+ export const currentTime = () =>
67
+ makeTemporal(
68
+ "current_time",
69
+ { dialect: "mysql", kind: "time" } as Expression.DbType.MySqlTime,
70
+ LocalTimeStringSchema
71
+ )
72
+
73
+ /** MySQL current timestamp. */
74
+ export const currentTimestamp = () =>
75
+ makeTemporal(
76
+ "current_timestamp",
77
+ { dialect: "mysql", kind: "timestamp" } as Expression.DbType.MySqlTimestamp,
78
+ LocalDateTimeStringSchema
79
+ )
80
+
81
+ /** MySQL local time. */
82
+ export const localTime = () =>
83
+ makeTemporal(
84
+ "localtime",
85
+ { dialect: "mysql", kind: "time" } as Expression.DbType.MySqlTime,
86
+ LocalTimeStringSchema
87
+ )
88
+
89
+ /** MySQL local timestamp. */
90
+ export const localTimestamp = () =>
91
+ makeTemporal(
92
+ "localtimestamp",
93
+ { dialect: "mysql", kind: "timestamp" } as Expression.DbType.MySqlTimestamp,
94
+ LocalDateTimeStringSchema
95
+ )
96
+
97
+ /** MySQL current instant-like timestamp. */
98
+ export const now = () =>
99
+ makeTemporal(
100
+ "now",
101
+ { dialect: "mysql", kind: "timestamp" } as Expression.DbType.MySqlTimestamp,
102
+ LocalDateTimeStringSchema
103
+ )
@@ -0,0 +1,7 @@
1
+ import { mysqlQuery } from "../private/query.js"
2
+
3
+ /** MySQL window functions. */
4
+ export const over = mysqlQuery.over
5
+ export const rowNumber = mysqlQuery.rowNumber
6
+ export const rank = mysqlQuery.rank
7
+ export const denseRank = mysqlQuery.denseRank
@@ -0,0 +1,13 @@
1
+ import * as Expression from "../../internal/expression.js"
2
+ import { makeDialectQuery } from "../../internal/query-factory.js"
3
+ import { mysqlDatatypes } from "../datatypes/index.js"
4
+
5
+ export const mysqlQuery = makeDialectQuery({
6
+ dialect: "mysql",
7
+ textDb: { dialect: "mysql", kind: "text" } as Expression.DbType.MySqlText,
8
+ numericDb: { dialect: "mysql", kind: "double" } as Expression.DbType.MySqlDouble,
9
+ boolDb: { dialect: "mysql", kind: "boolean" } as Expression.DbType.MySqlBool,
10
+ timestampDb: { dialect: "mysql", kind: "timestamp" } as Expression.DbType.MySqlTimestamp,
11
+ nullDb: { dialect: "mysql", kind: "null" } as Expression.DbType.Base<"mysql", "null">,
12
+ type: mysqlDatatypes
13
+ })
@@ -1,5 +1,3 @@
1
- import * as Expression from "../internal/expression.js"
2
- import { mysqlDatatypes } from "./datatypes/index.js"
3
1
  import {
4
2
  type CapabilitiesOfPlan,
5
3
  type CompletePlan,
@@ -37,22 +35,11 @@ import {
37
35
  type StatementOfPlan,
38
36
  type StringExpressionInput
39
37
  } from "../internal/query.js"
40
- import { makeDialectQuery } from "../internal/query-factory.js"
41
-
42
- const mysqlQuery = makeDialectQuery({
43
- dialect: "mysql",
44
- textDb: { dialect: "mysql", kind: "text" } as Expression.DbType.MySqlText,
45
- numericDb: { dialect: "mysql", kind: "double" } as Expression.DbType.MySqlDouble,
46
- boolDb: { dialect: "mysql", kind: "boolean" } as Expression.DbType.MySqlBool,
47
- timestampDb: { dialect: "mysql", kind: "timestamp" } as Expression.DbType.MySqlTimestamp,
48
- nullDb: { dialect: "mysql", kind: "null" } as Expression.DbType.Base<"mysql", "null">,
49
- type: mysqlDatatypes
50
- })
38
+ import { mysqlQuery } from "./private/query.js"
51
39
 
52
40
  export const literal = mysqlQuery.literal
53
41
  export const cast = mysqlQuery.cast
54
42
  export const type = mysqlQuery.type
55
- export const json = mysqlQuery.json
56
43
  export const eq = mysqlQuery.eq
57
44
  export const neq = mysqlQuery.neq
58
45
  export const lt = mysqlQuery.lt
@@ -61,8 +48,6 @@ export const gt = mysqlQuery.gt
61
48
  export const gte = mysqlQuery.gte
62
49
  export const isNull = mysqlQuery.isNull
63
50
  export const isNotNull = mysqlQuery.isNotNull
64
- export const upper = mysqlQuery.upper
65
- export const lower = mysqlQuery.lower
66
51
  export const like = mysqlQuery.like
67
52
  export const ilike = mysqlQuery.ilike
68
53
  export const and = mysqlQuery.and
@@ -72,22 +57,13 @@ export const all = mysqlQuery.all
72
57
  export const any = mysqlQuery.any
73
58
  const case_ = mysqlQuery.case
74
59
  export const match = mysqlQuery.match
75
- export const coalesce = mysqlQuery.coalesce
76
60
  export const in_ = mysqlQuery.in
77
61
  export const notIn = mysqlQuery.notIn
78
62
  export const between = mysqlQuery.between
79
63
  export const contains = mysqlQuery.contains
80
64
  export const containedBy = mysqlQuery.containedBy
81
65
  export const overlaps = mysqlQuery.overlaps
82
- export const concat = mysqlQuery.concat
83
66
  export const exists = mysqlQuery.exists
84
- export const over = mysqlQuery.over
85
- export const rowNumber = mysqlQuery.rowNumber
86
- export const rank = mysqlQuery.rank
87
- export const denseRank = mysqlQuery.denseRank
88
- export const count = mysqlQuery.count
89
- export const max = mysqlQuery.max
90
- export const min = mysqlQuery.min
91
67
  export const isDistinctFrom = mysqlQuery.isDistinctFrom
92
68
  export const isNotDistinctFrom = mysqlQuery.isNotDistinctFrom
93
69
  export const excluded = mysqlQuery.excluded
@@ -103,7 +79,6 @@ export const values = mysqlQuery.values
103
79
  export const unnest = mysqlQuery.unnest
104
80
  export const generateSeries = mysqlQuery.generateSeries
105
81
  export const returning = mysqlQuery.returning
106
- export const defaultValues = mysqlQuery.defaultValues
107
82
  export const onConflict = mysqlQuery.onConflict
108
83
  export const insert = mysqlQuery.insert
109
84
  export const update = mysqlQuery.update
package/src/mysql.ts CHANGED
@@ -6,6 +6,8 @@ export * as Datatypes from "./mysql/datatypes/index.js"
6
6
  export * as Errors from "./mysql/errors/index.js"
7
7
  /** Shared scalar SQL expression interfaces and DB-type descriptors. */
8
8
  export * as Expression from "./internal/expression.js"
9
+ /** MySQL-specialized SQL function expressions. */
10
+ export * as Function from "./mysql/function/index.js"
9
11
  /** MySQL-specialized typed query execution contracts. */
10
12
  export * as Executor from "./mysql/executor.js"
11
13
  /** Shared logical query-plan interfaces. */
@@ -1,8 +1,8 @@
1
1
  export {
2
2
  boolean,
3
3
  date,
4
+ default_ as default,
4
5
  generated,
5
- hasDefault,
6
6
  int,
7
7
  json,
8
8
  nullable,
@@ -2,8 +2,8 @@ import * as Effect from "effect/Effect"
2
2
  import * as SqlClient from "@effect/sql/SqlClient"
3
3
 
4
4
  import * as CoreExecutor from "../internal/executor.js"
5
- import * as Query from "./query.js"
6
- import * as Renderer from "./renderer.js"
5
+ import * as CoreQuery from "../internal/query.js"
6
+ import * as CoreRenderer from "../internal/renderer.js"
7
7
  import {
8
8
  narrowPostgresDriverErrorForReadQuery,
9
9
  normalizePostgresDriverError,
@@ -19,17 +19,19 @@ export type RowDecodeError = CoreExecutor.RowDecodeError
19
19
  export type Driver<Error = never, Context = never> = CoreExecutor.Driver<"postgres", Error, Context>
20
20
  /** Postgres-specialized executor contract. */
21
21
  export type Executor<Error = never, Context = never> = CoreExecutor.Executor<"postgres", Error, Context>
22
+ /** Postgres-specialized renderer contract. */
23
+ export type Renderer = CoreRenderer.Renderer<"postgres">
22
24
  /** Optional renderer / driver overrides for the standard Postgres executor pipeline. */
23
25
  export interface MakeOptions<Error = never, Context = never> {
24
- readonly renderer?: Renderer.Renderer
26
+ readonly renderer?: Renderer
25
27
  readonly driver?: Driver<Error, Context>
26
28
  readonly driverMode?: CoreExecutor.DriverMode
27
29
  }
28
30
  /** Standard composed error shape for Postgres executors. */
29
31
  export type PostgresExecutorError = PostgresDriverError | RowDecodeError
30
32
  /** Read-query error surface emitted by built-in Postgres executors. */
31
- export type PostgresQueryError<PlanValue extends Query.QueryPlan<any, any, any, any, any, any, any, any, any, any>> =
32
- Exclude<Query.CapabilitiesOfPlan<PlanValue>, "read"> extends never ? PostgresReadQueryError : PostgresExecutorError
33
+ export type PostgresQueryError<PlanValue extends CoreQuery.QueryPlan<any, any, any, any, any, any, any, any, any, any>> =
34
+ Exclude<CoreQuery.CapabilitiesOfPlan<PlanValue>, "read"> extends never ? PostgresReadQueryError : PostgresExecutorError
33
35
 
34
36
  /** Runs an effect within the ambient Postgres SQL transaction service. */
35
37
  export const withTransaction = CoreExecutor.withTransaction
@@ -39,9 +41,9 @@ export const withSavepoint = CoreExecutor.withSavepoint
39
41
  /** Postgres executor whose error channel narrows based on the query plan. */
40
42
  export interface QueryExecutor<Context = never> {
41
43
  readonly dialect: "postgres"
42
- execute<PlanValue extends Query.QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
43
- plan: Query.DialectCompatiblePlan<PlanValue, "postgres">
44
- ): Effect.Effect<Query.ResultRows<PlanValue>, PostgresQueryError<PlanValue>, Context>
44
+ execute<PlanValue extends CoreQuery.QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
45
+ plan: CoreQuery.DialectCompatiblePlan<PlanValue, "postgres">
46
+ ): Effect.Effect<CoreQuery.ResultRows<PlanValue>, PostgresQueryError<PlanValue>, Context>
45
47
  }
46
48
 
47
49
  /** Constructs a Postgres-specialized SQL driver. */
@@ -56,7 +58,7 @@ const fromDriver = <
56
58
  Error = never,
57
59
  Context = never
58
60
  >(
59
- renderer: Renderer.Renderer,
61
+ renderer: Renderer,
60
62
  sqlDriver: Driver<Error, Context>,
61
63
  driverMode: CoreExecutor.DriverMode = "raw"
62
64
  ): QueryExecutor<Context> => ({
@@ -85,7 +87,7 @@ const fromDriver = <
85
87
  })
86
88
 
87
89
  const sqlClientDriver = (): Driver<any, SqlClient.SqlClient> =>
88
- driver((query: Renderer.RenderedQuery<any>) =>
90
+ driver((query: CoreRenderer.RenderedQuery<any, "postgres">) =>
89
91
  Effect.flatMap(SqlClient.SqlClient, (sql) =>
90
92
  sql.unsafe<FlatRow>(query.sql, [...query.params])))
91
93
 
@@ -99,13 +101,13 @@ const sqlClientDriver = (): Driver<any, SqlClient.SqlClient> =>
99
101
  export function make(): QueryExecutor<SqlClient.SqlClient>
100
102
  export function make(
101
103
  options: {
102
- readonly renderer?: Renderer.Renderer
104
+ readonly renderer?: Renderer
103
105
  readonly driverMode?: CoreExecutor.DriverMode
104
106
  }
105
107
  ): QueryExecutor<SqlClient.SqlClient>
106
108
  export function make<Error = never, Context = never>(
107
109
  options: {
108
- readonly renderer?: Renderer.Renderer
110
+ readonly renderer?: Renderer
109
111
  readonly driver: Driver<Error, Context>
110
112
  readonly driverMode?: CoreExecutor.DriverMode
111
113
  }
@@ -114,9 +116,9 @@ export function make<Error = never, Context = never>(
114
116
  options: MakeOptions<Error, Context> = {}
115
117
  ): QueryExecutor<any> {
116
118
  if (options.driver) {
117
- return fromDriver(options.renderer ?? Renderer.make(), options.driver, options.driverMode)
119
+ return fromDriver(options.renderer ?? CoreRenderer.make("postgres"), options.driver, options.driverMode)
118
120
  }
119
- return fromDriver(options.renderer ?? Renderer.make(), sqlClientDriver(), options.driverMode)
121
+ return fromDriver(options.renderer ?? CoreRenderer.make("postgres"), sqlClientDriver(), options.driverMode)
120
122
  }
121
123
 
122
124
  /** Creates a Postgres-specialized executor from a typed implementation callback. */
@@ -124,8 +126,8 @@ export const custom = <
124
126
  Error = never,
125
127
  Context = never
126
128
  >(
127
- execute: <PlanValue extends Query.QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
128
- plan: Query.DialectCompatiblePlan<PlanValue, "postgres">
129
- ) => Effect.Effect<Query.ResultRows<PlanValue>, Error, Context>
129
+ execute: <PlanValue extends CoreQuery.QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
130
+ plan: CoreQuery.DialectCompatiblePlan<PlanValue, "postgres">
131
+ ) => Effect.Effect<CoreQuery.ResultRows<PlanValue>, Error, Context>
130
132
  ): Executor<Error, Context> =>
131
133
  CoreExecutor.make("postgres", execute as any) as Executor<Error, Context>
@@ -0,0 +1,6 @@
1
+ import { postgresQuery } from "../private/query.js"
2
+
3
+ /** Postgres aggregate functions. */
4
+ export const count = postgresQuery.count
5
+ export const max = postgresQuery.max
6
+ export const min = postgresQuery.min
@@ -0,0 +1,4 @@
1
+ import { postgresQuery } from "../private/query.js"
2
+
3
+ /** Postgres scalar core functions. */
4
+ export const coalesce = postgresQuery.coalesce
@@ -0,0 +1,19 @@
1
+ export * as core from "./core.js"
2
+ export * as string from "./string.js"
3
+ export * as aggregate from "./aggregate.js"
4
+ export * as window from "./window.js"
5
+ export { json } from "./json.js"
6
+ export * as temporal from "./temporal.js"
7
+
8
+ export { coalesce } from "./core.js"
9
+ export { lower, upper, concat } from "./string.js"
10
+ export { count, max, min } from "./aggregate.js"
11
+ export { over, rowNumber, rank, denseRank } from "./window.js"
12
+ export {
13
+ currentDate,
14
+ currentTime,
15
+ currentTimestamp,
16
+ localTime,
17
+ localTimestamp,
18
+ now
19
+ } from "./temporal.js"
@@ -0,0 +1,4 @@
1
+ import { postgresQuery } from "../private/query.js"
2
+
3
+ /** Postgres JSON expression helpers. */
4
+ export const json = postgresQuery.json
@@ -0,0 +1,6 @@
1
+ import { postgresQuery } from "../private/query.js"
2
+
3
+ /** Postgres string functions. */
4
+ export const lower = postgresQuery.lower
5
+ export const upper = postgresQuery.upper
6
+ export const concat = postgresQuery.concat
@@ -0,0 +1,107 @@
1
+ import type * as Schema from "effect/Schema"
2
+
3
+ import type * as Expression from "../../internal/expression.js"
4
+ import type * as ExpressionAst from "../../internal/expression-ast.js"
5
+ import { makeExpression } from "../../internal/query.js"
6
+ import {
7
+ InstantStringSchema,
8
+ LocalDateStringSchema,
9
+ LocalDateTimeStringSchema,
10
+ LocalTimeStringSchema,
11
+ OffsetTimeStringSchema,
12
+ type InstantString,
13
+ type LocalDateString,
14
+ type LocalDateTimeString,
15
+ type LocalTimeString,
16
+ type OffsetTimeString
17
+ } from "../../internal/runtime-value.js"
18
+
19
+ type TemporalExpression<
20
+ Runtime,
21
+ Db extends Expression.DbType.Any,
22
+ Name extends string
23
+ > = Expression.Expression<
24
+ Runtime,
25
+ Db,
26
+ "never",
27
+ "postgres",
28
+ "scalar",
29
+ never,
30
+ {},
31
+ "resolved"
32
+ > & {
33
+ readonly [ExpressionAst.TypeId]: ExpressionAst.FunctionCallNode<Name, readonly []>
34
+ }
35
+
36
+ const makeTemporal = <
37
+ Runtime,
38
+ Db extends Expression.DbType.Any,
39
+ Name extends string
40
+ >(
41
+ name: Name,
42
+ dbType: Db,
43
+ runtimeSchema: Schema.Schema<Runtime, any, any>
44
+ ): TemporalExpression<Runtime, Db, Name> =>
45
+ makeExpression({
46
+ runtime: undefined as unknown as Runtime,
47
+ dbType,
48
+ runtimeSchema,
49
+ nullability: "never",
50
+ dialect: "postgres",
51
+ aggregation: "scalar",
52
+ source: undefined as never,
53
+ dependencies: {},
54
+ sourceNullability: "resolved"
55
+ }, {
56
+ kind: "function",
57
+ name,
58
+ args: []
59
+ }) as TemporalExpression<Runtime, Db, Name>
60
+
61
+ /** Postgres current instant. */
62
+ export const now = () =>
63
+ makeTemporal(
64
+ "now",
65
+ { dialect: "postgres", kind: "timestamptz" } as Expression.DbType.PgTimestamptz,
66
+ InstantStringSchema
67
+ )
68
+
69
+ /** Postgres current date. */
70
+ export const currentDate = () =>
71
+ makeTemporal(
72
+ "current_date",
73
+ { dialect: "postgres", kind: "date" } as Expression.DbType.PgDate,
74
+ LocalDateStringSchema
75
+ )
76
+
77
+ /** Postgres current time with time zone. */
78
+ export const currentTime = () =>
79
+ makeTemporal(
80
+ "current_time",
81
+ { dialect: "postgres", kind: "timetz" } as Expression.DbType.PgTimetz,
82
+ OffsetTimeStringSchema
83
+ )
84
+
85
+ /** Postgres current timestamp with time zone. */
86
+ export const currentTimestamp = () =>
87
+ makeTemporal(
88
+ "current_timestamp",
89
+ { dialect: "postgres", kind: "timestamptz" } as Expression.DbType.PgTimestamptz,
90
+ InstantStringSchema
91
+ )
92
+
93
+ /** Postgres local time without time zone. */
94
+ export const localTime = () =>
95
+ makeTemporal(
96
+ "localtime",
97
+ { dialect: "postgres", kind: "time" } as Expression.DbType.PgTime,
98
+ LocalTimeStringSchema
99
+ )
100
+
101
+ /** Postgres local timestamp without time zone. */
102
+ export const localTimestamp = () =>
103
+ makeTemporal(
104
+ "localtimestamp",
105
+ { dialect: "postgres", kind: "timestamp" } as Expression.DbType.PgTimestamp,
106
+ LocalDateTimeStringSchema
107
+ )
@@ -0,0 +1,7 @@
1
+ import { postgresQuery } from "../private/query.js"
2
+
3
+ /** Postgres window functions. */
4
+ export const over = postgresQuery.over
5
+ export const rowNumber = postgresQuery.rowNumber
6
+ export const rank = postgresQuery.rank
7
+ export const denseRank = postgresQuery.denseRank
@@ -0,0 +1,13 @@
1
+ import * as Expression from "../../internal/expression.js"
2
+ import { makeDialectQuery } from "../../internal/query-factory.js"
3
+ import { postgresDatatypes } from "../datatypes/index.js"
4
+
5
+ export const postgresQuery = makeDialectQuery({
6
+ dialect: "postgres",
7
+ textDb: { dialect: "postgres", kind: "text" } as Expression.DbType.PgText,
8
+ numericDb: { dialect: "postgres", kind: "float8" } as Expression.DbType.PgFloat8,
9
+ boolDb: { dialect: "postgres", kind: "bool" } as Expression.DbType.PgBool,
10
+ timestampDb: { dialect: "postgres", kind: "timestamp" } as Expression.DbType.PgTimestamp,
11
+ nullDb: { dialect: "postgres", kind: "null" } as Expression.DbType.Base<"postgres", "null">,
12
+ type: postgresDatatypes
13
+ })
@@ -1,5 +1,4 @@
1
- import * as Expression from "../internal/expression.js"
2
- import { postgresDatatypes } from "./datatypes/index.js"
1
+ import { postgresQuery } from "./private/query.js"
3
2
  import {
4
3
  type CapabilitiesOfPlan,
5
4
  type CompletePlan,
@@ -37,22 +36,10 @@ import {
37
36
  type StatementOfPlan,
38
37
  type StringExpressionInput
39
38
  } from "../internal/query.js"
40
- import { makeDialectQuery } from "../internal/query-factory.js"
41
-
42
- const postgresQuery = makeDialectQuery({
43
- dialect: "postgres",
44
- textDb: { dialect: "postgres", kind: "text" } as Expression.DbType.PgText,
45
- numericDb: { dialect: "postgres", kind: "float8" } as Expression.DbType.PgFloat8,
46
- boolDb: { dialect: "postgres", kind: "bool" } as Expression.DbType.PgBool,
47
- timestampDb: { dialect: "postgres", kind: "timestamp" } as Expression.DbType.PgTimestamp,
48
- nullDb: { dialect: "postgres", kind: "null" } as Expression.DbType.Base<"postgres", "null">,
49
- type: postgresDatatypes
50
- })
51
39
 
52
40
  export const literal = postgresQuery.literal
53
41
  export const cast = postgresQuery.cast
54
42
  export const type = postgresQuery.type
55
- export const json = postgresQuery.json
56
43
  export const eq = postgresQuery.eq
57
44
  export const neq = postgresQuery.neq
58
45
  export const lt = postgresQuery.lt
@@ -61,8 +48,6 @@ export const gt = postgresQuery.gt
61
48
  export const gte = postgresQuery.gte
62
49
  export const isNull = postgresQuery.isNull
63
50
  export const isNotNull = postgresQuery.isNotNull
64
- export const upper = postgresQuery.upper
65
- export const lower = postgresQuery.lower
66
51
  export const like = postgresQuery.like
67
52
  export const ilike = postgresQuery.ilike
68
53
  export const and = postgresQuery.and
@@ -72,22 +57,13 @@ export const all = postgresQuery.all
72
57
  export const any = postgresQuery.any
73
58
  const case_ = postgresQuery.case
74
59
  export const match = postgresQuery.match
75
- export const coalesce = postgresQuery.coalesce
76
60
  export const in_ = postgresQuery.in
77
61
  export const notIn = postgresQuery.notIn
78
62
  export const between = postgresQuery.between
79
63
  export const contains = postgresQuery.contains
80
64
  export const containedBy = postgresQuery.containedBy
81
65
  export const overlaps = postgresQuery.overlaps
82
- export const concat = postgresQuery.concat
83
66
  export const exists = postgresQuery.exists
84
- export const over = postgresQuery.over
85
- export const rowNumber = postgresQuery.rowNumber
86
- export const rank = postgresQuery.rank
87
- export const denseRank = postgresQuery.denseRank
88
- export const count = postgresQuery.count
89
- export const max = postgresQuery.max
90
- export const min = postgresQuery.min
91
67
  export const isDistinctFrom = postgresQuery.isDistinctFrom
92
68
  export const isNotDistinctFrom = postgresQuery.isNotDistinctFrom
93
69
  export const excluded = postgresQuery.excluded
@@ -103,7 +79,6 @@ export const values = postgresQuery.values
103
79
  export const unnest = postgresQuery.unnest
104
80
  export const generateSeries = postgresQuery.generateSeries
105
81
  export const returning = postgresQuery.returning
106
- export const defaultValues = postgresQuery.defaultValues
107
82
  export const onConflict = postgresQuery.onConflict
108
83
  export const insert = postgresQuery.insert
109
84
  export const update = postgresQuery.update
package/src/postgres.ts CHANGED
@@ -6,6 +6,8 @@ export * as Datatypes from "./postgres/datatypes/index.js"
6
6
  export * as Errors from "./postgres/errors/index.js"
7
7
  /** Shared scalar SQL expression interfaces and DB-type descriptors. */
8
8
  export * as Expression from "./internal/expression.js"
9
+ /** Postgres-specialized SQL function expressions. */
10
+ export * as Function from "./postgres/function/index.js"
9
11
  /** Postgres-specialized typed query execution contracts. */
10
12
  export * as Executor from "./postgres/executor.js"
11
13
  /** Shared logical query-plan interfaces. */