Skip to content

Commit

Permalink
docs: remove non existent sql import
Browse files Browse the repository at this point in the history
resolves #57
  • Loading branch information
pi0 committed Oct 9, 2024
1 parent f5c30bf commit 9e5550f
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 16 deletions.
8 changes: 4 additions & 4 deletions docs/1.guide/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/2.connectors/bun.md
Original file line number Diff line number Diff line change
Expand Up @@ -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({}));
Expand Down
2 changes: 1 addition & 1 deletion docs/2.connectors/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions docs/2.connectors/libsql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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({}));
Expand Down
2 changes: 1 addition & 1 deletion docs/2.connectors/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions docs/2.connectors/pglite.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -28,6 +28,7 @@ const db = createDatabase(
```

<!-- copy from https://pglite.dev/docs/api#main-constructor -->

## Options

### `dataDir`
Expand Down Expand Up @@ -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`
**Type:** `number`
2 changes: 1 addition & 1 deletion docs/2.connectors/planetscale.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion docs/2.connectors/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion docs/2.connectors/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion docs/2.connectors/vercel.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9e5550f

Please sign in to comment.