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
624
624
debug : fn, // Is called with (connection, query, params, types)
625
+
socket : fn, // fn returning custom socket to use
625
626
transform : {
626
627
column : fn, // Transforms incoming column names
627
628
value : fn, // Transforms incoming row values
@@ -768,6 +769,31 @@ const [custom] = sql`
768
769
769
770
```
770
771
772
+
### Custom socket
773
+
774
+
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.
775
+
776
+
Here's a sample using [ssh2](https://github.com/mscdex/ssh2)
777
+
778
+
```js
779
+
importssh2from'ssh2'
780
+
781
+
constsql=postgres({
782
+
...options,
783
+
socket: ({ hostname, port }) =>newPromise((resolve, reject) => {
0 commit comments