You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
onparameter : fn, // (key, value) when server param change
620
620
debug : fn, // Is called with (connection, query, params, types)
621
+
socket : fn, // fn returning custom socket to use
621
622
transform : {
622
623
column : fn, // Transforms incoming column names
623
624
value : fn, // Transforms incoming row values
@@ -764,6 +765,31 @@ const [custom] = sql`
764
765
765
766
```
766
767
768
+
### Custom socket
769
+
770
+
Easily do in-process ssh tunneling to your database by providing a custom socket for Postgres.js to use. The function (optionally async) must return a socket-like duplex stream.
771
+
772
+
Here's a sample using [ssh2](https://github.com/mscdex/ssh2)
773
+
774
+
```js
775
+
importssh2from'ssh2'
776
+
777
+
constsql=postgres({
778
+
...options,
779
+
socket: ({ hostname, port }) =>newPromise((resolve, reject) => {
0 commit comments