{"repo":"planetscale/database-js","free":true,"listed":false,"github":"https://github.com/planetscale/database-js","clone":"git clone https://github.com/planetscale/database-js.git","description":"A Fetch API-compatible PlanetScale database driver","language":"TypeScript","stars":1198,"topics":["database","edge-computing","mysql","serverless","vercel"],"license":"Apache-2.0","category":"databases-storage","readme_excerpt":"PlanetScale serverless JavaScript driver for Vitess/MySQL A Fetch API-compatible PlanetScale Vitess/MySQL database driver for serverless and edge compute platforms that require HTTP external connections, such as Cloudflare Workers or Vercel Edge Functions [!TIP] Connecting to a PlanetScale Postgres database? We support the Neon serverless driver, read the documentation to connect. Installation Usage Database URL A single database URL value can be used to configure the host , username , and password values. Connection factory Use the Client connection factory class to create fresh connections for each transaction or web request handler. Transactions Use the transaction function to safely perform database transactions. If any unhandled errors are thrown during execution of the transaction, the transaction will be rolled back. The following example is based on the Slotted Counter Pattern. Custom fetch function Node.js version 18 includes a built-in global fetch function. When using an older version of Node.js, you can provide a custom fetch function implementation. We recommend the [ undici ][1] package on which Node's built-in fetch is based. [1]: https://github.com/nodejs/undici To leverage HTTP/2, you can use the [ fetch-h2 ][2] shim. fetch-h2 also supports Node.js 12+. [2]: https://www.npmjs.com/package/fetch-h2 Custom query parameter format function Query replacement parameters identified with ? are replaced with escaped values. Named replacement parameters are supported wi","default_branch":null,"files":null,"tree":[],"storefront":"/r/planetscale","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/planetscale/database-js/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}