diff --git a/docs/1.guide/1.index.md b/docs/1.guide/1.index.md index c96881b..d44348b 100644 --- a/docs/1.guide/1.index.md +++ b/docs/1.guide/1.index.md @@ -24,7 +24,7 @@ Install [`db0`](https://npmjs.com/package/db0) npm package: :pm-install{name="db0"} ```ts -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import sqlite from "db0/connectors/better-sqlite3"; // Initiate database with SQLite connector @@ -43,12 +43,12 @@ console.log(rows); // Using static parameters const tableName = "users"; -const { rows } = await db.sql`SELECT * FROM {${tableName}} WHERE id = ${userId}`; +const { rows } = + await db.sql`SELECT * FROM {${tableName}} WHERE id = ${userId}`; console.log(rows); ``` -> [!IMPORTANT] -> **Static Parameters** are a way to use string-literals other than places where prepared statements are supported, for eg. table name. **DO NOT USE** static parameters from untrusted source such as request body. **STATIC PARAMETERS ARE NOT SANITISED** +> [!IMPORTANT] > **Static Parameters** are a way to use string-literals other than places where prepared statements are supported, for eg. table name. **DO NOT USE** static parameters from untrusted source such as request body. **STATIC PARAMETERS ARE NOT SANITISED** ## Next steps diff --git a/docs/2.connectors/bun.md b/docs/2.connectors/bun.md index 55259f5..32b0c38 100644 --- a/docs/2.connectors/bun.md +++ b/docs/2.connectors/bun.md @@ -16,7 +16,7 @@ icon: simple-icons:bun Use `bun-sqlite` connector: ```js -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import bunSqlite from "db0/connectors/bun-sqlite"; const db = createDatabase(bunSqlite({})); diff --git a/docs/2.connectors/cloudflare.md b/docs/2.connectors/cloudflare.md index bbcb7c3..3627f59 100644 --- a/docs/2.connectors/cloudflare.md +++ b/docs/2.connectors/cloudflare.md @@ -16,7 +16,7 @@ icon: devicon-plain:cloudflareworkers Use `cloudflare-d1` connector: ```js -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import cloudflareD1 from "db0/connectors/cloudflare-d1"; const db = createDatabase( diff --git a/docs/2.connectors/libsql.md b/docs/2.connectors/libsql.md index 63718cb..3036ceb 100644 --- a/docs/2.connectors/libsql.md +++ b/docs/2.connectors/libsql.md @@ -19,21 +19,21 @@ Choose on of the `libsql`, `libsql/http` or `libsql/web` connectors depending on ::code-group ```ts [libsql.node.js] -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import libSql from "db0/connectors/libsql"; const db = createDatabase(libSql({ url: `file:local.db` })); ``` ```ts [libsql.http.js] -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import libSql from "db0/connectors/libsql/http"; const db = createDatabase(libSql({})); ``` ```ts [libsql.web.js] -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import libSql from "db0/connectors/libsql/web"; const db = createDatabase(libSql({})); diff --git a/docs/2.connectors/mysql.md b/docs/2.connectors/mysql.md index 1acaae4..513e5dc 100644 --- a/docs/2.connectors/mysql.md +++ b/docs/2.connectors/mysql.md @@ -15,7 +15,7 @@ For this connector, you need to install [`mysql2`](https://www.npmjs.com/package Use `mysql2` connector: ```js -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import mysql from "db0/connectors/mysql2"; const db = createDatabase( diff --git a/docs/2.connectors/pglite.md b/docs/2.connectors/pglite.md index 854f37f..f0e8858 100644 --- a/docs/2.connectors/pglite.md +++ b/docs/2.connectors/pglite.md @@ -17,7 +17,7 @@ For this connector, you need to install [`@electric-sql/pglite`](https://www.npm Use `pglite` connector: ```js -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import pglite from "db0/connectors/pglite"; const db = createDatabase( @@ -28,6 +28,7 @@ const db = createDatabase( ``` + ## Options ### `dataDir` @@ -92,4 +93,4 @@ The database from the Postgres cluster within the `dataDir` to connect to. The initial amount of memory in bytes to allocate for the PGlite instance. PGlite will grow the memory automatically, but if you have a particularly large database, you can set this higher to prevent the pause during memory growth. -**Type:** `number` \ No newline at end of file +**Type:** `number` diff --git a/docs/2.connectors/planetscale.md b/docs/2.connectors/planetscale.md index 77076dd..d401dfc 100644 --- a/docs/2.connectors/planetscale.md +++ b/docs/2.connectors/planetscale.md @@ -17,7 +17,7 @@ For this connector, you need to install [`@planetscale/database`](https://www.np Use `planetscale` connector: ```js -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import planetscale from "db0/connectors/planetscale"; const db = createDatabase( diff --git a/docs/2.connectors/postgresql.md b/docs/2.connectors/postgresql.md index 4e57ce0..0482ba0 100644 --- a/docs/2.connectors/postgresql.md +++ b/docs/2.connectors/postgresql.md @@ -17,7 +17,7 @@ For this connector, you need to install [`pg`](https://www.npmjs.com/package/pg) Use `postgresql` connector: ```js -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import postgresql from "db0/connectors/postgresql"; const db = createDatabase( diff --git a/docs/2.connectors/sqlite.md b/docs/2.connectors/sqlite.md index 6dc5af0..16dd128 100644 --- a/docs/2.connectors/sqlite.md +++ b/docs/2.connectors/sqlite.md @@ -17,7 +17,7 @@ For this connector, you need to install [`better-sqlite3`](https://www.npmjs.com Use `better-sqlite3` connector: ```js -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import sqlite from "db0/connectors/better-sqlite3"; const db = createDatabase( diff --git a/docs/2.connectors/vercel.md b/docs/2.connectors/vercel.md index 7f1bedf..28cb208 100644 --- a/docs/2.connectors/vercel.md +++ b/docs/2.connectors/vercel.md @@ -17,7 +17,7 @@ A dedicated `vercel` connector is planned to be supported. Follow up via [unjs/d Use [`postgres`](/connectors/postgresql) connector: ```js -import { createDatabase, sql } from "db0"; +import { createDatabase } from "db0"; import postgres from "db0/connectors/postgres"; const db = createDatabase(