File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,28 @@ const results = await conn.execute('select 1 from dual')
102
102
console .log (results )
103
103
```
104
104
105
+ To leverage HTTP/2, you can use the [ ` fetch-h2 ` ] [ 1 ] shim. ` fetch-h2 ` also supports Node.js 12+.
106
+
107
+ [ 1 ] : https://www.npmjs.com/package/fetch-h2
108
+
109
+ ``` ts
110
+ import { connect } from ' @planetscale/database'
111
+ import { context } from ' fetch-h2'
112
+ const { fetch, disconnectAll } = context ()
113
+
114
+ const config = {
115
+ fetch ,
116
+ host: ' <host>' ,
117
+ username: ' <user>' ,
118
+ password: ' <password>'
119
+ }
120
+
121
+ const conn = connect (config )
122
+ const results = await conn .execute (' select 1 from dual' )
123
+ console .log (results )
124
+ await disconnectAll ()
125
+ ```
126
+
105
127
### Custom query parameter format function
106
128
107
129
Query replacement parameters identified with ` ? ` are replaced with escaped values. Named replacement parameters are supported with a colon prefix.
You can’t perform that action at this time.
0 commit comments