okmodel 0.7.0 → 0.9.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.
- package/README.md +14 -0
- package/dist/adapters/capabilities.d.ts +32 -0
- package/dist/adapters/failure.d.ts +1 -1
- package/dist/adapters/pg/bun-sql.d.ts +53 -0
- package/dist/adapters/pg/bunsql-extra.d.ts +1 -1
- package/dist/adapters/pg/bunsql.d.ts +1 -1
- package/dist/adapters/pg/neon-extra.d.ts +18 -0
- package/dist/adapters/pg/neon.d.ts +104 -0
- package/dist/adapters/pg/no-inflight-timeout.d.ts +1 -1
- package/dist/contracts/error.d.ts +1 -1
- package/dist/dialects/pg/ext/btree-gin.d.ts +26 -0
- package/dist/dialects/pg/ext/btree-gin.js +20 -0
- package/dist/dialects/pg/ext/btree-gist.d.ts +26 -0
- package/dist/dialects/pg/ext/btree-gist.js +20 -0
- package/dist/dialects/pg/ext/call.d.ts +53 -0
- package/dist/dialects/pg/ext/citext.js +1 -1
- package/dist/dialects/pg/ext/feature.d.ts +26 -0
- package/dist/dialects/pg/ext/fuzzystrmatch.d.ts +34 -0
- package/dist/dialects/pg/ext/fuzzystrmatch.js +33 -0
- package/dist/dialects/pg/ext/hstore.d.ts +41 -0
- package/dist/dialects/pg/ext/hstore.js +29 -0
- package/dist/dialects/pg/ext/index.d.ts +56 -0
- package/dist/dialects/pg/ext/index.js +1 -1
- package/dist/dialects/pg/ext/ltree.d.ts +41 -0
- package/dist/dialects/pg/ext/ltree.js +29 -0
- package/dist/dialects/pg/ext/pg-trgm.js +4 -13
- package/dist/dialects/pg/ext/pgcrypto.d.ts +33 -0
- package/dist/dialects/pg/ext/pgcrypto.js +33 -0
- package/dist/dialects/pg/ext/unaccent.d.ts +26 -0
- package/dist/dialects/pg/ext/unaccent.js +21 -0
- package/dist/dialects/pg/ext/using.d.ts +23 -0
- package/dist/dialects/pg/ext/versions.d.ts +36 -0
- package/dist/dialects/pg/external.d.ts +19 -0
- package/dist/dialects/pg/fn/index.d.ts +39 -1
- package/dist/dialects/pg/fn/index.js +118 -26
- package/dist/dialects/pg/index.d.ts +3 -0
- package/dist/dialects/pg/index.js +394 -14
- package/dist/dialects/pg/introspect.d.ts +11 -0
- package/dist/dialects/pg/operators.d.ts +1 -1
- package/dist/dialects/pg/ops/fragment.d.ts +119 -0
- package/dist/dialects/pg/ops/lane.d.ts +49 -0
- package/dist/dialects/pg/view/client.d.ts +14 -6
- package/dist/dialects/pg/view/index.d.ts +73 -1
- package/dist/dialects/pg/view/index.js +156 -5
- package/dist/dialects/pg/view/scratch.d.ts +11 -5
- package/dist/runtime/artifact-file.d.ts +22 -0
- package/dist/runtime/client.d.ts +10 -0
- package/dist/runtime/drift-detail.d.ts +2 -1
- package/dist/runtime/drift.d.ts +3 -10
- package/dist/runtime/otel.d.ts +105 -0
- package/dist/runtime/otel.js +97 -0
- package/dist/runtime/pg/bun.js +4 -4
- package/dist/runtime/pg/neon.d.ts +38 -0
- package/dist/runtime/pg/neon.js +64 -0
- package/dist/runtime/pg/pg.js +4 -4
- package/dist/runtime/pg/pglite.js +4 -4
- package/dist/runtime/pg/postgresjs.js +4 -4
- package/dist/runtime/plan.d.ts +1 -1
- package/dist/runtime/server-check.d.ts +36 -6
- package/dist/runtime/sql-fragment.d.ts +43 -0
- package/dist/runtime/tenancy/index.js +10 -10
- package/dist/runtime/topology.d.ts +1 -1
- package/dist/runtime/traits/index.js +16 -17
- package/dist/runtime/types.d.ts +15 -1
- package/dist/runtime/validate/index.js +4 -4
- package/dist/shared/{81ebdx9p.js → 0j6qe91y.js} +4 -4
- package/dist/shared/{qq3899ht.js → 12z7aznj.js} +243 -14
- package/dist/shared/{gzaveazc.js → 1d9q9cv2.js} +29 -2
- package/dist/shared/{w79hsckn.js → 1mxm04fy.js} +5 -5
- package/dist/shared/{7k9grvf6.js → 2szgv6yj.js} +5 -5
- package/dist/shared/{gs74dbj5.js → 2zdxkt7b.js} +933 -111
- package/dist/shared/{m6p12kbr.js → 3456242y.js} +23 -23
- package/dist/shared/3bb7wsqt.js +99 -0
- package/dist/shared/{y6njgyda.js → 3t6kw83m.js} +2 -2
- package/dist/shared/{xhfsfkgk.js → 4vbf83xx.js} +9 -2
- package/dist/shared/{pt94kz7f.js → 5kyb3tqx.js} +1 -1
- package/dist/shared/61bmrmhr.js +35 -0
- package/dist/shared/{x933k9a3.js → 62b603gr.js} +10 -10
- package/dist/shared/{jgqj11w4.js → 6f0z3hzh.js} +4 -0
- package/dist/shared/{tsvww22q.js → 6nae0spm.js} +156 -95
- package/dist/shared/{mtaszv5a.js → 71n0jmhc.js} +102 -4
- package/dist/shared/{5e3tf63j.js → 760ppr76.js} +14 -6
- package/dist/shared/7ba5h6pb.js +17 -0
- package/dist/shared/{sfz1ksn6.js → 8jesqsrk.js} +2 -2
- package/dist/shared/{5v3xf80k.js → 8n688yjg.js} +1 -1
- package/dist/shared/{rs73fca9.js → 8qzkd9f3.js} +6 -6
- package/dist/shared/{ax7qv55k.js → 90sg0w5a.js} +202 -25
- package/dist/shared/{zm0ptry0.js → 99qp9vtg.js} +1 -1
- package/dist/shared/{xnxsed62.js → 9dr2qnx7.js} +14 -14
- package/dist/shared/{1w508jbr.js → 9dtgn1z2.js} +21 -17
- package/dist/shared/{h15jx9bc.js → 9dvh1dr6.js} +1 -1
- package/dist/shared/{q5c6ngn3.js → a62rb2da.js} +1 -1
- package/dist/shared/{te5as7z7.js → aksb89mn.js} +3 -3
- package/dist/shared/{bz84tkzm.js → bphrgwz9.js} +2 -2
- package/dist/shared/bsek72fg.js +225 -0
- package/dist/shared/{7mnme5tn.js → c3mvnq7a.js} +1 -1
- package/dist/shared/{p6qc5gcp.js → ccsmhv9r.js} +25 -7
- package/dist/shared/{pbp1ss85.js → cexb7z6b.js} +2 -2
- package/dist/shared/{ab9gmbwy.js → cf8zdz5p.js} +5 -5
- package/dist/shared/{jvd0mqag.js → ckz05z15.js} +5 -5
- package/dist/shared/{dk8v79p3.js → d5nmj7vv.js} +1 -1
- package/dist/shared/{14vx95q4.js → dd5pmnky.js} +7 -7
- package/dist/shared/{vb6qfyve.js → ds229x4r.js} +2 -2
- package/dist/shared/{1qa0qajz.js → e275q7sd.js} +1 -1
- package/dist/shared/{zp9fmend.js → ebhz8vh6.js} +4 -4
- package/dist/shared/{hyh73qk6.js → ecn8mfdq.js} +5 -5
- package/dist/shared/{je4axnm8.js → fdsz3w80.js} +2 -2
- package/dist/shared/{9s0ypp87.js → fk9vef30.js} +85 -74
- package/dist/shared/{g6evj1j3.js → g89fmz5s.js} +1 -1
- package/dist/shared/{aytqh5y2.js → ghqzdp94.js} +2 -2
- package/dist/shared/h9811jjm.js +17 -0
- package/dist/shared/{dkxgzaqd.js → hqpxf4a4.js} +1 -1
- package/dist/shared/{8skf0cam.js → jpybhf98.js} +1 -1
- package/dist/shared/{67txcrcw.js → kgwp4jdd.js} +4 -4
- package/dist/shared/kzgrnckd.js +29 -0
- package/dist/shared/mazpbcdj.js +233 -0
- package/dist/shared/{kb2sdhfb.js → mfvx6kjx.js} +17 -1
- package/dist/shared/{svncdeh5.js → mgaq2sd3.js} +11 -8
- package/dist/shared/{5mtf6cj3.js → mvmm3xpb.js} +5 -2
- package/dist/shared/{b5pftnn2.js → myk8fswx.js} +66 -21
- package/dist/shared/{2shdbn8q.js → n306gqkd.js} +9 -9
- package/dist/shared/{n816peh1.js → n454kcnw.js} +1 -1
- package/dist/shared/n5whk3mt.js +665 -0
- package/dist/shared/n7kg8mmx.js +61 -0
- package/dist/shared/{vqrjpcqn.js → nmnsgj7x.js} +1 -1
- package/dist/shared/{tbrvgw6z.js → npdftanb.js} +19 -26
- package/dist/shared/{ek2wt2dz.js → pg4ezgyf.js} +11 -30
- package/dist/shared/{5fe3kbsh.js → pgsak1yw.js} +1 -1
- package/dist/shared/{bm22fvzr.js → qfw14tna.js} +2 -2
- package/dist/shared/{wa07eas9.js → qvwwp1mp.js} +62 -41
- package/dist/shared/rbxt795q.js +1766 -0
- package/dist/shared/{xjk7hnn5.js → s7he5e5d.js} +2 -2
- package/dist/shared/{w72kgg4q.js → ss2kv2rs.js} +6 -6
- package/dist/shared/stfa9xcw.js +450 -0
- package/dist/shared/{3v7t1yrv.js → th3be82n.js} +2 -2
- package/dist/shared/{79dt02vc.js → tr64w5p0.js} +1 -1
- package/dist/shared/{cn957f8d.js → tw1nvvfj.js} +3 -3
- package/dist/shared/{ed0b8k4s.js → typ3vy7t.js} +1 -1
- package/dist/shared/{9628a9xt.js → vk7rag46.js} +1 -1
- package/dist/shared/{ze4hxsmy.js → w9ejzaqf.js} +1 -1
- package/dist/shared/{vczs8gd4.js → wvtjg5m3.js} +2 -2
- package/dist/shared/{9y3mmmh1.js → xfhe73sb.js} +1 -1
- package/dist/shared/xqacq37x.js +61 -0
- package/dist/shared/{1est4ezg.js → xtsydxjg.js} +3 -3
- package/dist/shared/xv8qj97g.js +96 -0
- package/dist/shared/{bg3rym3g.js → xwhdcrm4.js} +2 -2
- package/dist/shared/{kr0jzbw2.js → yvabyg9k.js} +7 -7
- package/dist/shared/yybhre6n.js +136 -0
- package/dist/shared/zdqf8k5d.js +8 -0
- package/dist/shared/{jznfax0y.js → zq1he88x.js} +4 -4
- package/dist/tooling/cli.js +108 -23
- package/dist/tooling/driver-run.js +4654 -0
- package/dist/tooling/driver-test.d.ts +36 -0
- package/dist/tooling/github/comment.d.ts +50 -0
- package/dist/tooling/github/post-comment.d.ts +17 -0
- package/dist/tooling/migrate/commands.d.ts +3 -2
- package/dist/tooling/migrate/config.d.ts +13 -0
- package/dist/tooling/migrate/export.d.ts +165 -0
- package/dist/tooling/migrate/ext-surface.d.ts +80 -0
- package/dist/tooling/migrate/ext.d.ts +31 -4
- package/dist/tooling/migrate/import-drizzle.d.ts +40 -0
- package/dist/tooling/migrate/index.d.ts +3 -0
- package/dist/tooling/migrate/index.js +55 -10
- package/dist/tooling/migrate/lint-rules.d.ts +18 -1
- package/dist/tooling/migrate/lint.d.ts +14 -1
- package/dist/tooling/migrate/place.d.ts +18 -0
- package/dist/tooling/migrate/plan-json.d.ts +65 -0
- package/dist/tooling/migrate/project.d.ts +13 -1
- package/dist/tooling/migrate/pull-emit.d.ts +98 -0
- package/dist/tooling/migrate/pull-routines.d.ts +126 -0
- package/dist/tooling/migrate/pull-verify.d.ts +26 -0
- package/dist/tooling/migrate/pull.d.ts +62 -0
- package/dist/tooling/migrate/reprint.d.ts +32 -0
- package/dist/tooling/migrate/sandbox.d.ts +8 -2
- package/dist/tooling/migrate/schema-api.d.ts +43 -0
- package/dist/tooling/migrate/sql-lex.d.ts +18 -0
- package/dist/tooling/shared/04svnxxj.js +344 -0
- package/dist/tooling/shared/0j0jtse1.js +13 -0
- package/dist/tooling/shared/0r05zhyq.js +618 -0
- package/dist/tooling/shared/1800eymw.js +49 -0
- package/dist/tooling/shared/35zemrmf.js +12 -0
- package/dist/tooling/shared/3rmaz3pq.js +140 -0
- package/dist/tooling/shared/3yn79q5m.js +12 -0
- package/dist/tooling/shared/54tqkxja.js +51 -0
- package/dist/tooling/shared/57btdkgm.js +209 -0
- package/dist/tooling/shared/5bmksndh.js +118 -0
- package/dist/tooling/shared/5p8km5jb.js +38 -0
- package/dist/tooling/shared/5x3pf400.js +185 -0
- package/dist/tooling/shared/5zrzffnk.js +6 -0
- package/dist/tooling/shared/62fxpc1p.js +332 -0
- package/dist/tooling/shared/68tf18v4.js +20 -0
- package/dist/tooling/shared/6vk28rjp.js +98 -0
- package/dist/tooling/shared/76pv6qff.js +9 -0
- package/dist/tooling/shared/7aews1zg.js +311 -0
- package/dist/tooling/shared/7b3xp9gc.js +195 -0
- package/dist/tooling/shared/7kms6fvj.js +20 -0
- package/dist/tooling/shared/7pxncnzs.js +40 -0
- package/dist/tooling/shared/829fjxyw.js +198 -0
- package/dist/tooling/shared/8m5znpdt.js +66 -0
- package/dist/tooling/shared/8yr7ges1.js +211 -0
- package/dist/tooling/shared/96ps4g1z.js +32 -0
- package/dist/tooling/shared/9qr9rkbh.js +143 -0
- package/dist/tooling/shared/9sfbtwsk.js +49 -0
- package/dist/tooling/shared/9wsnsvbf.js +10 -0
- package/dist/tooling/shared/a2xe04bm.js +18 -0
- package/dist/tooling/shared/a4pzghha.js +20 -0
- package/dist/tooling/shared/am04v8na.js +233 -0
- package/dist/tooling/shared/asgr07mp.js +194 -0
- package/dist/tooling/shared/c0xevn1h.js +312 -0
- package/dist/tooling/shared/dhatassp.js +134 -0
- package/dist/tooling/shared/ezqn88nj.js +1696 -0
- package/dist/tooling/shared/f77nnfqy.js +231 -0
- package/dist/tooling/shared/fh07z1dt.js +15 -0
- package/dist/tooling/shared/gqwevek4.js +81 -0
- package/dist/tooling/shared/hfq3n3bd.js +4116 -0
- package/dist/tooling/shared/htnaj77v.js +17 -0
- package/dist/tooling/shared/j664qjrt.js +64 -0
- package/dist/tooling/shared/jpgmjsx3.js +38 -0
- package/dist/tooling/shared/jr2nmr81.js +497 -0
- package/dist/tooling/shared/jsjjz875.js +139 -0
- package/dist/tooling/shared/kbqnrs1x.js +1425 -0
- package/dist/tooling/shared/kz715295.js +94 -0
- package/dist/tooling/shared/m3xt8b1h.js +22 -0
- package/dist/tooling/shared/m4hhb8aa.js +9 -0
- package/dist/tooling/shared/mw5npye0.js +16 -0
- package/dist/tooling/shared/n4jqhpqz.js +27 -0
- package/dist/tooling/shared/nxq95eb6.js +42 -0
- package/dist/tooling/shared/qartgazh.js +70 -0
- package/dist/tooling/shared/rcywj2w8.js +190 -0
- package/dist/tooling/shared/s6qha57m.js +16 -0
- package/dist/tooling/shared/shjs0379.js +150 -0
- package/dist/tooling/shared/sjwkt1pg.js +16 -0
- package/dist/tooling/shared/stebqyyd.js +401 -0
- package/dist/tooling/shared/t4xveemq.js +250 -0
- package/dist/tooling/shared/t6zjeake.js +261 -0
- package/dist/tooling/shared/tcwpjvxe.js +9 -0
- package/dist/tooling/shared/tpssp7ac.js +160 -0
- package/dist/tooling/shared/v6j1ep6w.js +42 -0
- package/dist/tooling/shared/vwr2y833.js +270 -0
- package/dist/tooling/shared/w17sj05d.js +7 -0
- package/dist/tooling/shared/w5d89rb4.js +131 -0
- package/dist/tooling/shared/wbwq1jsa.js +157 -0
- package/dist/tooling/shared/wezxf3h8.js +17 -0
- package/dist/tooling/shared/yb4kd19s.js +12 -0
- package/dist/tooling/shared/ybdew6j7.js +294 -0
- package/dist/tooling/shared/yfedr1zb.js +6 -0
- package/dist/tooling/shared/yhp829bx.js +177 -0
- package/dist/tooling/shared/ytk1tjs0.js +604 -0
- package/dist/tooling/shared/zs9aymcp.js +210 -0
- package/dist/tooling/shared/zx3v9phv.js +8 -0
- package/dist/tooling/testing/index.js +3 -3
- package/package.json +50 -9
- package/dist/shared/ktz42yez.js +0 -113
- package/dist/shared/ttsqgp4p.js +0 -71
- package/dist/shared/y34a8714.js +0 -150
- package/dist/shared/zy8r7qvz.js +0 -116
- package/dist/shared/{ywr8hmey.js → 606g0nbf.js} +3 -3
- package/dist/shared/{rpycarcr.js → gcefca6p.js} +4 -4
package/README.md
CHANGED
|
@@ -135,6 +135,20 @@ export async function removeNote(id: string) {
|
|
|
135
135
|
|
|
136
136
|
`okm push` is for a database you can recreate. A shared database uses reviewed migrations: `okm generate init`, then `okm migrate apply`.
|
|
137
137
|
|
|
138
|
+
## 0.9
|
|
139
|
+
|
|
140
|
+
This release is the tooling train. `okm pull` writes schema files from a database. `okm import drizzle` writes them from a Drizzle schema. Several catalogs share one database through `external()` and `okm catalog export`. `describe` and `buildCatalog` are on `okmodel/migrate`. Extension packs cover `unaccent`, `hstore`, `ltree`, `btree_gist`, `btree_gin`, `fuzzystrmatch`, and `pgcrypto`. The GitHub Action posts the migration plan on a pull request. A type change that rewrites a table is five migrations, not one `ALTER COLUMN … TYPE`.
|
|
141
|
+
|
|
142
|
+
| Want… | Go to |
|
|
143
|
+
| ----------------------- | ---------------------------------------------------------------------- |
|
|
144
|
+
| Pull a database | [pull](https://okm.omqkhafi.dev/docs/reference/cli#pull) |
|
|
145
|
+
| Import Drizzle | [From Drizzle](https://okm.omqkhafi.dev/docs/start/from-drizzle) |
|
|
146
|
+
| Several catalogs | [Catalogs](https://okm.omqkhafi.dev/docs/define/schema/catalogs) |
|
|
147
|
+
| `describe` | [Schema API](https://okm.omqkhafi.dev/docs/reference/schema-api) |
|
|
148
|
+
| Extension packs | [Extensions](https://okm.omqkhafi.dev/docs/define/schema/extensions) |
|
|
149
|
+
| The GitHub Action | [GitHub Action](https://okm.omqkhafi.dev/docs/reference/github-action) |
|
|
150
|
+
| A rewriting type change | [Type change](https://okm.omqkhafi.dev/docs/reference/type-change) |
|
|
151
|
+
|
|
138
152
|
## Next
|
|
139
153
|
|
|
140
154
|
| Want… | Go to |
|
|
@@ -78,6 +78,38 @@ export declare const BUNSQL_CAPABILITIES: {
|
|
|
78
78
|
readonly prepared: "unnamed";
|
|
79
79
|
readonly describe: false;
|
|
80
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Neon WebSocket pool execution flags.
|
|
83
|
+
*
|
|
84
|
+
* Interactive transactions pass on a direct connection. `stream`, `listen`,
|
|
85
|
+
* `cancel`, and `describe` stay false: a server cursor, `LISTEN`, and a
|
|
86
|
+
* side-channel cancel are session features the pooler does not keep, and the
|
|
87
|
+
* client has no describe API. Statements use the unnamed protocol.
|
|
88
|
+
* `prepared: "named"` is not for a transaction-mode pooler.
|
|
89
|
+
*/
|
|
90
|
+
export declare const NEON_WEBSOCKET_CAPABILITIES: {
|
|
91
|
+
readonly transactions: "interactive";
|
|
92
|
+
readonly stream: false;
|
|
93
|
+
readonly listen: false;
|
|
94
|
+
readonly cancel: false;
|
|
95
|
+
readonly prepared: "unnamed";
|
|
96
|
+
readonly describe: false;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Neon HTTP execution flags.
|
|
100
|
+
*
|
|
101
|
+
* One request is one statement. `sql.transaction` is the atomic batch.
|
|
102
|
+
* There is no interactive `tx()`, no `LISTEN`, no server cursor, and no
|
|
103
|
+
* cancel of a statement the server has already started.
|
|
104
|
+
*/
|
|
105
|
+
export declare const NEON_HTTP_CAPABILITIES: {
|
|
106
|
+
readonly transactions: "batch";
|
|
107
|
+
readonly stream: false;
|
|
108
|
+
readonly listen: false;
|
|
109
|
+
readonly cancel: false;
|
|
110
|
+
readonly prepared: "none";
|
|
111
|
+
readonly describe: false;
|
|
112
|
+
};
|
|
81
113
|
/**
|
|
82
114
|
* Reads one capability flag.
|
|
83
115
|
*
|
|
@@ -22,7 +22,7 @@ export declare function rejectClosed(): Promise<never>;
|
|
|
22
22
|
/**
|
|
23
23
|
* Rejects with OKM1120 when a driver cannot cancel a positive timeout.
|
|
24
24
|
*
|
|
25
|
-
* The message stays `timeout`. Kind stays `invalid`. Bun.sql and
|
|
25
|
+
* The message stays `timeout`. Kind stays `invalid`. Bun.sql, PGlite, and Neon call
|
|
26
26
|
* this. Other drivers do not, so their connect graphs omit it.
|
|
27
27
|
*
|
|
28
28
|
* @returns A rejected promise
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slice of Bun.sql this adapter uses.
|
|
3
|
+
*
|
|
4
|
+
* `bun` is the runtime, not an npm package, and it ships no types. The
|
|
5
|
+
* published declarations name these types instead of importing `bun`, so a
|
|
6
|
+
* consumer can typecheck `okmodel/pg/bun` without `bun-types`.
|
|
7
|
+
*/
|
|
8
|
+
/** A pending query. `raw()` asks for rows as arrays. */
|
|
9
|
+
export interface SQLQuery extends Promise<unknown> {
|
|
10
|
+
/** Rows as arrays instead of objects. */
|
|
11
|
+
raw(): SQLQuery;
|
|
12
|
+
}
|
|
13
|
+
/** One pooled Bun.sql client. */
|
|
14
|
+
export interface SQL {
|
|
15
|
+
/**
|
|
16
|
+
* Runs a statement.
|
|
17
|
+
*
|
|
18
|
+
* @param text - SQL text
|
|
19
|
+
* @param values - Positional parameters
|
|
20
|
+
*/
|
|
21
|
+
unsafe(text: string, values?: readonly unknown[]): SQLQuery;
|
|
22
|
+
/**
|
|
23
|
+
* Checks out one connection.
|
|
24
|
+
*
|
|
25
|
+
* @param options - `signal` aborts the wait
|
|
26
|
+
*/
|
|
27
|
+
reserve(options?: {
|
|
28
|
+
readonly signal?: AbortSignal;
|
|
29
|
+
}): Promise<ReservedSQL>;
|
|
30
|
+
/** Closes the pool. */
|
|
31
|
+
close(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Subscribes to one `LISTEN` channel.
|
|
34
|
+
*
|
|
35
|
+
* @param channel - Channel name
|
|
36
|
+
* @param onnotify - Payload callback
|
|
37
|
+
*/
|
|
38
|
+
listen(channel: string, onnotify: (payload: string) => void): Promise<SQLListen>;
|
|
39
|
+
}
|
|
40
|
+
/** A `LISTEN` registration. */
|
|
41
|
+
export interface SQLListen {
|
|
42
|
+
/** Drops this registration. */
|
|
43
|
+
unlisten(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* One connection reserved from {@link SQL.reserve}.
|
|
47
|
+
*
|
|
48
|
+
* `release` returns it to the pool.
|
|
49
|
+
*/
|
|
50
|
+
export interface ReservedSQL extends SQL {
|
|
51
|
+
/** Returns the connection to the pool. */
|
|
52
|
+
release(): void;
|
|
53
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Loaded on the first reserve, batch, stream, or dead connection. A read that
|
|
5
5
|
* succeeds does not use it.
|
|
6
6
|
*/
|
|
7
|
-
import type { ReservedSQL, SQL } from "bun";
|
|
7
|
+
import type { ReservedSQL, SQL } from "./bun-sql.js";
|
|
8
8
|
import type { DriverConnection, WireValue } from "../../contracts/driver.js";
|
|
9
9
|
import { type HeldPool } from "./bunsql.js";
|
|
10
10
|
/**
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* finished script exits without `close()`. `Query.cancel()` does not abort
|
|
10
10
|
* the backend, so `cancel` is false. Server notices are not surfaced.
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
12
|
+
import type { ReservedSQL, SQL } from "./bun-sql.js";
|
|
13
13
|
import type { DriverPool, DriverPoolConfig, WireValue } from "../../contracts/driver.js";
|
|
14
14
|
import { DriverError } from "../error.js";
|
|
15
15
|
import { noticeBuffer, type WireQuery } from "./session.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reserved connections for the Neon WebSocket pool.
|
|
3
|
+
*
|
|
4
|
+
* Loaded on the first reserve or batch. A read does not use it.
|
|
5
|
+
*/
|
|
6
|
+
import type { DriverConnection } from "../../contracts/driver.js";
|
|
7
|
+
import { type HeldPool } from "./neon.js";
|
|
8
|
+
/**
|
|
9
|
+
* Checks out one client and clears it on release.
|
|
10
|
+
*
|
|
11
|
+
* A client whose connection is gone is destroyed on release, and nothing more
|
|
12
|
+
* is sent to it. A checked-out client has no pool error listener, so one is
|
|
13
|
+
* set here: without it a dropped socket is an uncaught `error` event.
|
|
14
|
+
*
|
|
15
|
+
* @param held - The pool and its counters
|
|
16
|
+
* @returns A connection the caller must release
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkout(held: HeldPool): Promise<DriverConnection>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Neon adapter (`okmodel/pg/neon`).
|
|
3
|
+
*
|
|
4
|
+
* `@neondatabase/serverless` is an optional peer. This module is the only
|
|
5
|
+
* place that imports it. `mode: "websocket"` (the default) is a pooled
|
|
6
|
+
* WebSocket client with interactive transactions. `mode: "http"` is one HTTP
|
|
7
|
+
* request per statement, and `batch` is the driver's non-interactive
|
|
8
|
+
* transaction. A positive `timeout` is refused: neither mode aborts a
|
|
9
|
+
* statement the server has already started.
|
|
10
|
+
*
|
|
11
|
+
* The first WebSocket `open` sets `webSocketConstructor` only when it is
|
|
12
|
+
* still unset, so a caller can install one first. A transaction-mode pooler
|
|
13
|
+
* does not promise session state. One small compute can reuse a backend, so
|
|
14
|
+
* a custom `SET`, `LISTEN`, or a prepared statement may still be visible.
|
|
15
|
+
*/
|
|
16
|
+
import { Pool, type PoolClient } from "@neondatabase/serverless";
|
|
17
|
+
import type { DriverPool, DriverPoolConfig, WireValue } from "../../contracts/driver.js";
|
|
18
|
+
import { noticeBuffer, type WireQuery } from "./session.js";
|
|
19
|
+
export { NEON_WEBSOCKET_CAPABILITIES as capabilities, NEON_HTTP_CAPABILITIES as httpCapabilities, hasCapability, readCapability, } from "../capabilities.js";
|
|
20
|
+
export { DriverError } from "../error.js";
|
|
21
|
+
/** How {@link open} talks to Neon. */
|
|
22
|
+
export type NeonMode = "websocket" | "http";
|
|
23
|
+
/** Options for {@link open}. */
|
|
24
|
+
export type NeonConfig = DriverPoolConfig & {
|
|
25
|
+
/** Connection URL for this endpoint. */
|
|
26
|
+
readonly url: string;
|
|
27
|
+
/**
|
|
28
|
+
* `websocket` is a pooled WebSocket client. `http` is one-shot HTTP.
|
|
29
|
+
*
|
|
30
|
+
* Omitted means `websocket`.
|
|
31
|
+
*/
|
|
32
|
+
readonly mode?: NeonMode;
|
|
33
|
+
/**
|
|
34
|
+
* Named prepared statements, or the unnamed protocol.
|
|
35
|
+
*
|
|
36
|
+
* Unnamed is the default. It stays valid behind a pooler in transaction mode.
|
|
37
|
+
* `prepared: "named"` is not for transaction-mode poolers. HTTP ignores it.
|
|
38
|
+
*/
|
|
39
|
+
readonly prepared?: "named" | "unnamed";
|
|
40
|
+
/** Session search path for every WebSocket connection in the pool. */
|
|
41
|
+
readonly searchPath?: string;
|
|
42
|
+
};
|
|
43
|
+
/** Pool occupancy. */
|
|
44
|
+
export type Counters = {
|
|
45
|
+
reserved: number;
|
|
46
|
+
busy: number;
|
|
47
|
+
reservedBusy: number;
|
|
48
|
+
waiting: number;
|
|
49
|
+
};
|
|
50
|
+
/** What a WebSocket checkout needs from the pool that opened it. */
|
|
51
|
+
export type HeldPool = {
|
|
52
|
+
readonly pool: Pool;
|
|
53
|
+
readonly acquireMs: number | undefined;
|
|
54
|
+
readonly counters: Counters;
|
|
55
|
+
readonly notices: ReturnType<typeof noticeBuffer>;
|
|
56
|
+
readonly named: boolean;
|
|
57
|
+
readonly isClosed: () => boolean;
|
|
58
|
+
};
|
|
59
|
+
/** A client that can run one array-mode statement. */
|
|
60
|
+
type Queryable = {
|
|
61
|
+
query(config: {
|
|
62
|
+
text: string;
|
|
63
|
+
values?: readonly WireValue[];
|
|
64
|
+
rowMode: "array";
|
|
65
|
+
types: typeof WIRE;
|
|
66
|
+
name?: string;
|
|
67
|
+
}): Promise<unknown>;
|
|
68
|
+
};
|
|
69
|
+
declare const WIRE: {
|
|
70
|
+
getTypeParser(): (value: string) => string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Opens a Neon pool for one endpoint.
|
|
74
|
+
*
|
|
75
|
+
* WebSocket mode connects once before returning, so a later short acquire
|
|
76
|
+
* timeout measures the queue and not a cold start. HTTP mode does not open a
|
|
77
|
+
* socket.
|
|
78
|
+
*
|
|
79
|
+
* @param config - URL, mode, pool size, and acquire timeout
|
|
80
|
+
* @returns The pool
|
|
81
|
+
*/
|
|
82
|
+
export declare function open(config: NeonConfig): Promise<DriverPool>;
|
|
83
|
+
/**
|
|
84
|
+
* Checks out one WebSocket client.
|
|
85
|
+
*
|
|
86
|
+
* The wait uses `timeouts.acquire`. A timeout is OKM1846 and does not keep the
|
|
87
|
+
* client.
|
|
88
|
+
*
|
|
89
|
+
* @param pool - Neon pool
|
|
90
|
+
* @param acquireMs - Wait ceiling, when one was set
|
|
91
|
+
* @param counters - Pool occupancy
|
|
92
|
+
* @returns The client
|
|
93
|
+
*/
|
|
94
|
+
export declare function connectClient(pool: Pool, acquireMs: number | undefined, counters: Counters): Promise<PoolClient>;
|
|
95
|
+
/**
|
|
96
|
+
* Sends one statement and returns the driver's promise.
|
|
97
|
+
*
|
|
98
|
+
* @param runner - Pool or checked-out client
|
|
99
|
+
* @param text - SQL
|
|
100
|
+
* @param params - Wire parameters
|
|
101
|
+
* @param named - Use a named prepared statement
|
|
102
|
+
* @returns The pending result
|
|
103
|
+
*/
|
|
104
|
+
export declare function send(runner: Queryable, text: string, params: readonly WireValue[] | undefined, named: boolean): WireQuery;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Refusal for a driver that cannot cancel an in-flight statement (D224).
|
|
3
3
|
*
|
|
4
|
-
* Bun.sql and
|
|
4
|
+
* Bun.sql, PGlite, and Neon refuse a positive `timeout`. The OKM1120 text loads with
|
|
5
5
|
* the lazy error module, so a connect entry does not carry it. Kind is
|
|
6
6
|
* `invalid`, which separates it from kind `timeout`. `timeout: 0` still fails
|
|
7
7
|
* immediately as kind `timeout`. `signal` is unchanged. postgres.js and
|
|
@@ -31,7 +31,7 @@ export type ColumnCode = (typeof COLUMN_CODES)[number];
|
|
|
31
31
|
* These are spec §21 codes. They are a type only, so the runtime entry does
|
|
32
32
|
* not gain a second registry.
|
|
33
33
|
*/
|
|
34
|
-
export type QueryCode = "OKM1101" | "OKM1102" | "OKM1104" | "OKM1105" | "OKM1111" | "OKM1120" | "OKM1121" | "OKM1124" | "OKM1130" | "OKM1190" | "OKM1701" | "OKM1704" | "OKM1801" | "OKM1802" | "OKM1803" | "OKM1843";
|
|
34
|
+
export type QueryCode = "OKM1101" | "OKM1102" | "OKM1104" | "OKM1105" | "OKM1111" | "OKM1120" | "OKM1121" | "OKM1124" | "OKM1125" | "OKM1130" | "OKM1190" | "OKM1701" | "OKM1704" | "OKM1801" | "OKM1802" | "OKM1803" | "OKM1843";
|
|
35
35
|
/** Kinds from spec §14, in category order. */
|
|
36
36
|
export declare const ERROR_KINDS: readonly ["invalid", "not_null", "check", "foreign_key", "unique", "exclusion", "conflict", "not_found", "not_unique", "forbidden", "serialization", "deadlock", "lock_timeout", "timeout", "cancelled", "unavailable", "schema_drift", "driver", "read_only", "outcome_unknown"];
|
|
37
37
|
/** One spec §14 kind. */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `btree_gin` extension. `gin` stores a GIN operator class for scalar equality.
|
|
3
|
+
*
|
|
4
|
+
* Generated by scripts/ext-generate.ts. Do not edit.
|
|
5
|
+
* `minPostgres` for the base methods is 15. A feature
|
|
6
|
+
* a declared version lacks fails with OKM1812.
|
|
7
|
+
*/
|
|
8
|
+
import type { IndexCall } from "../table.js";
|
|
9
|
+
import { type Extension, type ExtensionOptions } from "./index.js";
|
|
10
|
+
/** `btree_gin` plus the methods the naming overlay selected. */
|
|
11
|
+
export type BtreeGin = Extension & {
|
|
12
|
+
/**
|
|
13
|
+
* A GIN index with `int4_ops`.
|
|
14
|
+
*
|
|
15
|
+
* @param column - SQL column name
|
|
16
|
+
* @returns An index call whose expression is the `using` tail
|
|
17
|
+
*/
|
|
18
|
+
gin(column: string): IndexCall;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Declares `btree_gin`.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Schema and version pin
|
|
24
|
+
* @returns The extension object and its methods
|
|
25
|
+
*/
|
|
26
|
+
export declare function btreeGin(options?: ExtensionOptions): BtreeGin;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extension2
|
|
3
|
+
} from "../../../shared/6f0z3hzh.js";
|
|
4
|
+
import {
|
|
5
|
+
usingIndex
|
|
6
|
+
} from "../../../shared/h9811jjm.js";
|
|
7
|
+
|
|
8
|
+
// src/dialects/pg/ext/btree-gin.ts
|
|
9
|
+
function btreeGin(options = {}) {
|
|
10
|
+
const declared = extension2("btree_gin", options);
|
|
11
|
+
return {
|
|
12
|
+
...declared,
|
|
13
|
+
gin(column) {
|
|
14
|
+
return usingIndex(column, "gin", "int4_ops");
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
btreeGin
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `btree_gist` extension. `gist` stores a GiST operator class so an exclude constraint can use `=`.
|
|
3
|
+
*
|
|
4
|
+
* Generated by scripts/ext-generate.ts. Do not edit.
|
|
5
|
+
* `minPostgres` for the base methods is 15. A feature
|
|
6
|
+
* a declared version lacks fails with OKM1812.
|
|
7
|
+
*/
|
|
8
|
+
import type { IndexCall } from "../table.js";
|
|
9
|
+
import { type Extension, type ExtensionOptions } from "./index.js";
|
|
10
|
+
/** `btree_gist` plus the methods the naming overlay selected. */
|
|
11
|
+
export type BtreeGist = Extension & {
|
|
12
|
+
/**
|
|
13
|
+
* A GiST index with `gist_int4_ops`.
|
|
14
|
+
*
|
|
15
|
+
* @param column - SQL column name
|
|
16
|
+
* @returns An index call whose expression is the `using` tail
|
|
17
|
+
*/
|
|
18
|
+
gist(column: string): IndexCall;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Declares `btree_gist`.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Schema and version pin
|
|
24
|
+
* @returns The extension object and its methods
|
|
25
|
+
*/
|
|
26
|
+
export declare function btreeGist(options?: ExtensionOptions): BtreeGist;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extension2
|
|
3
|
+
} from "../../../shared/6f0z3hzh.js";
|
|
4
|
+
import {
|
|
5
|
+
usingIndex
|
|
6
|
+
} from "../../../shared/h9811jjm.js";
|
|
7
|
+
|
|
8
|
+
// src/dialects/pg/ext/btree-gist.ts
|
|
9
|
+
function btreeGist(options = {}) {
|
|
10
|
+
const declared = extension2("btree_gist", options);
|
|
11
|
+
return {
|
|
12
|
+
...declared,
|
|
13
|
+
gist(column) {
|
|
14
|
+
return usingIndex(column, "gist", "gist_int4_ops");
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
btreeGist
|
|
20
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQL fragments for an extension function or operator.
|
|
3
|
+
*
|
|
4
|
+
* The fragment is the whole predicate, the same way `fragment` is. Values
|
|
5
|
+
* are parameters. The schema and function names are quoted identifiers the
|
|
6
|
+
* generator wrote.
|
|
7
|
+
*/
|
|
8
|
+
import { type Fragment } from "../ops/fragment.js";
|
|
9
|
+
/**
|
|
10
|
+
* `schema.fn(column, …) = schema.fn($1)`.
|
|
11
|
+
*
|
|
12
|
+
* @param schema - Install schema
|
|
13
|
+
* @param name - Function name
|
|
14
|
+
* @param value - Parameter
|
|
15
|
+
* @returns A where fragment
|
|
16
|
+
*/
|
|
17
|
+
export declare function fnEqualsArg(schema: string, name: string, value: string): Fragment;
|
|
18
|
+
/**
|
|
19
|
+
* `schema.fn(column, $1) = $2::integer`.
|
|
20
|
+
*
|
|
21
|
+
* @param schema - Install schema
|
|
22
|
+
* @param name - Function name
|
|
23
|
+
* @param value - Text argument
|
|
24
|
+
* @param distance - Integer the function result must equal
|
|
25
|
+
* @returns A where fragment
|
|
26
|
+
*/
|
|
27
|
+
export declare function fnDistance(schema: string, name: string, value: string, distance: number): Fragment;
|
|
28
|
+
/**
|
|
29
|
+
* `column <op> $1`, with an optional cast on the parameter.
|
|
30
|
+
*
|
|
31
|
+
* @param op - Operator token the generator wrote
|
|
32
|
+
* @param value - Parameter
|
|
33
|
+
* @param cast - SQL type to cast the parameter to, when the operator needs one
|
|
34
|
+
* @returns A where fragment
|
|
35
|
+
*/
|
|
36
|
+
export declare function opArg(op: string, value: string, cast?: string): Fragment;
|
|
37
|
+
/**
|
|
38
|
+
* `schema.fn()` as the whole predicate.
|
|
39
|
+
*
|
|
40
|
+
* @param schema - Install schema
|
|
41
|
+
* @param name - Function name
|
|
42
|
+
* @returns A where fragment
|
|
43
|
+
*/
|
|
44
|
+
export declare function bareCall(schema: string, name: string): Fragment;
|
|
45
|
+
/**
|
|
46
|
+
* `encode(schema.digest(column, $1), 'hex') = $2`.
|
|
47
|
+
*
|
|
48
|
+
* @param schema - Install schema
|
|
49
|
+
* @param algorithm - Digest algorithm, a parameter
|
|
50
|
+
* @param hex - Expected hex digest, a parameter
|
|
51
|
+
* @returns A where fragment
|
|
52
|
+
*/
|
|
53
|
+
export declare function digestEquals(schema: string, algorithm: string, hex: string): Fragment;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version gate for one extension feature (OKM1812).
|
|
3
|
+
*
|
|
4
|
+
* The factory reads the declared extension version. An omitted pin is
|
|
5
|
+
* unpinned: apply checks the server. A pin that still allows a version
|
|
6
|
+
* without the feature fails here, at the call, which is schema build when
|
|
7
|
+
* the schema file calls the method. The message names the feature, the
|
|
8
|
+
* extension version, and `minPostgres`.
|
|
9
|
+
*/
|
|
10
|
+
/** What a feature needs. */
|
|
11
|
+
export type FeatureNeed = {
|
|
12
|
+
/** Extension the feature belongs to. */
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/** Minimum extension version (`1.2`). */
|
|
15
|
+
readonly extension: string;
|
|
16
|
+
/** Minimum Postgres major. Named in the message. */
|
|
17
|
+
readonly postgres: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Refuses a pin that does not guarantee the feature.
|
|
21
|
+
*
|
|
22
|
+
* @param declared - `version` on the extension, when the caller set one
|
|
23
|
+
* @param feature - Feature name, such as `daitch_mokotoff`
|
|
24
|
+
* @param need - Versions the feature needs
|
|
25
|
+
*/
|
|
26
|
+
export declare function assertExtFeature(declared: string | undefined, feature: string, need: FeatureNeed): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `fuzzystrmatch` extension. `levenshtein` compares edit distance. `daitchMokotoff` needs version 1.2 and PostgreSQL 16.
|
|
3
|
+
*
|
|
4
|
+
* Generated by scripts/ext-generate.ts. Do not edit.
|
|
5
|
+
* `minPostgres` for the base methods is 15. A feature
|
|
6
|
+
* a declared version lacks fails with OKM1812.
|
|
7
|
+
*/
|
|
8
|
+
import type { Fragment } from "../ops/fragment.js";
|
|
9
|
+
import { type Extension, type ExtensionOptions } from "./index.js";
|
|
10
|
+
/** `fuzzystrmatch` plus the methods the naming overlay selected. */
|
|
11
|
+
export type Fuzzystrmatch = Extension & {
|
|
12
|
+
/**
|
|
13
|
+
* `levenshtein(column, value) = distance`.
|
|
14
|
+
*
|
|
15
|
+
* @param value - Text to compare
|
|
16
|
+
* @param distance - Edit distance the function must return
|
|
17
|
+
* @returns A where fragment
|
|
18
|
+
*/
|
|
19
|
+
levenshtein(value: string, distance: number): Fragment;
|
|
20
|
+
/**
|
|
21
|
+
* `daitch_mokotoff(column) = daitch_mokotoff(value)`. Needs fuzzystrmatch 1.2 and PostgreSQL 16.
|
|
22
|
+
*
|
|
23
|
+
* @param value - Text to compare
|
|
24
|
+
* @returns A where fragment
|
|
25
|
+
*/
|
|
26
|
+
daitchMokotoff(value: string): Fragment;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Declares `fuzzystrmatch`.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Schema and version pin
|
|
32
|
+
* @returns The extension object and its methods
|
|
33
|
+
*/
|
|
34
|
+
export declare function fuzzystrmatch(options?: ExtensionOptions): Fuzzystrmatch;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extension2
|
|
3
|
+
} from "../../../shared/6f0z3hzh.js";
|
|
4
|
+
import {
|
|
5
|
+
assertExtFeature
|
|
6
|
+
} from "../../../shared/kzgrnckd.js";
|
|
7
|
+
import {
|
|
8
|
+
fnEqualsArg,
|
|
9
|
+
fnDistance
|
|
10
|
+
} from "../../../shared/xqacq37x.js";
|
|
11
|
+
|
|
12
|
+
// src/dialects/pg/ext/fuzzystrmatch.ts
|
|
13
|
+
function fuzzystrmatch(options = {}) {
|
|
14
|
+
const declared = extension2("fuzzystrmatch", options);
|
|
15
|
+
const schema = declared.schema;
|
|
16
|
+
return {
|
|
17
|
+
...declared,
|
|
18
|
+
levenshtein(value, distance) {
|
|
19
|
+
return fnDistance(schema, "levenshtein", value, distance);
|
|
20
|
+
},
|
|
21
|
+
daitchMokotoff(value) {
|
|
22
|
+
assertExtFeature(options.version, "daitch_mokotoff", {
|
|
23
|
+
name: "fuzzystrmatch",
|
|
24
|
+
extension: "1.2",
|
|
25
|
+
postgres: 16
|
|
26
|
+
});
|
|
27
|
+
return fnEqualsArg(schema, "daitch_mokotoff", value);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
fuzzystrmatch
|
|
33
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `hstore` extension. `hasKey` is `?`. `gin` and `gist` index an hstore column.
|
|
3
|
+
*
|
|
4
|
+
* Generated by scripts/ext-generate.ts. Do not edit.
|
|
5
|
+
* `minPostgres` for the base methods is 15. A feature
|
|
6
|
+
* a declared version lacks fails with OKM1812.
|
|
7
|
+
*/
|
|
8
|
+
import type { Fragment } from "../ops/fragment.js";
|
|
9
|
+
import type { IndexCall } from "../table.js";
|
|
10
|
+
import { type Extension, type ExtensionOptions } from "./index.js";
|
|
11
|
+
/** `hstore` plus the methods the naming overlay selected. */
|
|
12
|
+
export type Hstore = Extension & {
|
|
13
|
+
/**
|
|
14
|
+
* `column ? key`.
|
|
15
|
+
*
|
|
16
|
+
* @param value - Text to compare
|
|
17
|
+
* @returns A where fragment
|
|
18
|
+
*/
|
|
19
|
+
hasKey(value: string): Fragment;
|
|
20
|
+
/**
|
|
21
|
+
* A GIN index with `gin_hstore_ops`.
|
|
22
|
+
*
|
|
23
|
+
* @param column - SQL column name
|
|
24
|
+
* @returns An index call whose expression is the `using` tail
|
|
25
|
+
*/
|
|
26
|
+
gin(column: string): IndexCall;
|
|
27
|
+
/**
|
|
28
|
+
* A GiST index with `gist_hstore_ops`.
|
|
29
|
+
*
|
|
30
|
+
* @param column - SQL column name
|
|
31
|
+
* @returns An index call whose expression is the `using` tail
|
|
32
|
+
*/
|
|
33
|
+
gist(column: string): IndexCall;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Declares `hstore`.
|
|
37
|
+
*
|
|
38
|
+
* @param options - Schema and version pin
|
|
39
|
+
* @returns The extension object and its methods
|
|
40
|
+
*/
|
|
41
|
+
export declare function hstore(options?: ExtensionOptions): Hstore;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extension2
|
|
3
|
+
} from "../../../shared/6f0z3hzh.js";
|
|
4
|
+
import {
|
|
5
|
+
opArg
|
|
6
|
+
} from "../../../shared/xqacq37x.js";
|
|
7
|
+
import {
|
|
8
|
+
usingIndex
|
|
9
|
+
} from "../../../shared/h9811jjm.js";
|
|
10
|
+
|
|
11
|
+
// src/dialects/pg/ext/hstore.ts
|
|
12
|
+
function hstore(options = {}) {
|
|
13
|
+
const declared = extension2("hstore", options);
|
|
14
|
+
return {
|
|
15
|
+
...declared,
|
|
16
|
+
hasKey(value) {
|
|
17
|
+
return opArg("?", value);
|
|
18
|
+
},
|
|
19
|
+
gin(column) {
|
|
20
|
+
return usingIndex(column, "gin", "gin_hstore_ops");
|
|
21
|
+
},
|
|
22
|
+
gist(column) {
|
|
23
|
+
return usingIndex(column, "gist", "gist_hstore_ops");
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
hstore
|
|
29
|
+
};
|