-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
6,993 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
node_modules | ||
*.iml | ||
.idea | ||
*.log* | ||
.nuxt | ||
.vscode | ||
.DS_Store | ||
coverage | ||
dist | ||
sw.* | ||
.env | ||
.output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
shamefully-hoist=true | ||
strict-peer-dependencies=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Documentation | ||
|
||
Docs are powered by [Docus](https://docus.dev). | ||
|
||
## Local Development | ||
|
||
Install dependencies: | ||
|
||
```bash | ||
pnpm install | ||
``` | ||
|
||
Start development server with: | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
Start editing [conent](./content) directory! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export default defineAppConfig({ | ||
docus: { | ||
title: "SQL0", | ||
description: "Universal Storage Layer.", | ||
header: { | ||
logo: false, | ||
}, | ||
socials: { | ||
twitter: "unjsio", | ||
github: "unjs/sql0", | ||
}, | ||
aside: { | ||
level: 0, | ||
exclude: [], | ||
}, | ||
footer: { | ||
iconLinks: [ | ||
{ | ||
href: "https://unjs.io", | ||
icon: "vscode-icons:file-type-js-official", | ||
label: "UnJS", | ||
}, | ||
], | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
navigation.title: Introduction | ||
--- | ||
|
||
# Introduction | ||
|
||
[unjs/sql0](https://github.com/unjs/sql0) provides an easy way to connect and query sql databases providers. | ||
|
||
## Features | ||
|
||
::list | ||
|
||
- Designed for all environments: Browser, NodeJS, and Workers | ||
- Well tested built-in connectors | ||
- Asynchronous API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
navigation.title: Cloudflare D1 | ||
--- | ||
|
||
# Cloudflare D1 Connector | ||
|
||
## Usage | ||
|
||
This connector works within cloudflare workers with D1 enabled. [Read More](https://developers.cloudflare.com/d1/) | ||
|
||
```js | ||
import { createDB, sql } from "sql0"; | ||
import cloudflareD1 from "sql0/connectors/cloudflare-d1"; | ||
|
||
const db = createDB( | ||
cloudflareD1({ | ||
bindingName: "DB", | ||
}) | ||
); | ||
``` | ||
|
||
## Options | ||
|
||
### `bindingName` | ||
|
||
Assigned binding name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
navigation.title: LibSQL | ||
--- | ||
|
||
# LibSQL Connector | ||
|
||
Connect to [LibSQL](https://libsql.org/) database. | ||
|
||
::alert{type="primary"} | ||
🚀 This connector will be comming soon! Follow up via [unjs/sql0#14](https://github.com/unjs/sql0/issues/14). | ||
:: | ||
|
||
```js | ||
import { createDB, sql } from "sql0"; | ||
import vercelPostgres from "sql0/connectors/libsql"; | ||
|
||
const db = createDB( | ||
libsql({ | ||
/* options */ | ||
}) | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
navigation.title: PlanetScale | ||
--- | ||
|
||
# PlanetScale Connector | ||
|
||
Connect to [Planetscale](https://planetscale.com/) database. | ||
|
||
::alert{type="primary"} | ||
🚀 This connector will be comming soon! Follow up via [unjs/sql0#4](https://github.com/unjs/sql0/issues/4). | ||
:: | ||
|
||
```js | ||
import { createDB, sql } from "sql0"; | ||
import planetscale from "sql0/connectors/planetscale"; | ||
|
||
const db = createDB( | ||
planetscale({ | ||
/* options */ | ||
}) | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
navigation.title: PostgreSQL | ||
--- | ||
|
||
# PostgreSQL Connector | ||
|
||
## Usage | ||
|
||
For this connector, you need to install [`pg`](https://www.npmjs.com/package/pg) dependency: | ||
|
||
::code-group | ||
|
||
```sh [npm] | ||
npm install pg@8 @types/pg@8 | ||
``` | ||
|
||
```sh [Yarn] | ||
yarn add pg@8 @types/pg@8 | ||
``` | ||
|
||
```sh [pnpm] | ||
pnpm add pg@8 @types/pg@8 | ||
``` | ||
|
||
:: | ||
|
||
```js | ||
import { createDB, sql } from "sql0"; | ||
import postgresql from "sql0/connectors/postgresql"; | ||
|
||
const db = createDB( | ||
postgresql({ | ||
bindingName: "DB", | ||
}) | ||
); | ||
``` | ||
|
||
## Options | ||
|
||
### `url` | ||
|
||
Connection URL string. | ||
|
||
Alternatively, you can add connection configuration. See [node-postgres](https://node-postgres.com/apis/client#new-client) documentation for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
navigation.title: SQLite | ||
--- | ||
|
||
# SQLite Connector | ||
|
||
## Usage | ||
|
||
For this connector, you need to install [`better-sqlite3`](https://www.npmjs.com/package/better-sqlite3) dependency: | ||
|
||
::code-group | ||
|
||
```sh [npm] | ||
npm install better-sqlite3@8 | ||
``` | ||
|
||
```sh [Yarn] | ||
yarn add better-sqlite3@8 | ||
``` | ||
|
||
```sh [pnpm] | ||
pnpm add better-sqlite3@8 | ||
``` | ||
|
||
:: | ||
|
||
```js | ||
import { createDB, sql } from "sql0"; | ||
import sqlite from "sql0/connectors/better-sqlite3"; | ||
|
||
const db = createDB( | ||
sqlite({ | ||
/* options */ | ||
}) | ||
); | ||
``` | ||
|
||
## Options | ||
|
||
### `cwd` | ||
|
||
Working directory to create database. Default is current working directory of project. (It will be ignored if `path` is provided an absolute path.) | ||
|
||
### `name` | ||
|
||
Database (file) name. Default is `db` | ||
|
||
### `path` | ||
|
||
Related (to `cwd`) or absolute path to the sql file. By default it is stored in `{cwd}/.data/{name}.sqlite3` / `.data/db.sqlite3` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
navigation.title: Turso | ||
--- | ||
|
||
# Turso Connector | ||
|
||
Connect to [Turso](https://turso.tech/) database. Follow up via [unjs/sql0#11](https://github.com/unjs/sql0/issues/11). | ||
|
||
::alert{type="primary"} | ||
🚀 This connector will be comming soon! | ||
:: | ||
|
||
```js | ||
import { createDB, sql } from "sql0"; | ||
import vercelPostgres from "sql0/connectors/turso"; | ||
|
||
const db = createDB( | ||
turso({ | ||
/* options */ | ||
}) | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
navigation.title: Vecel Postgresql | ||
--- | ||
|
||
# PlanetScale Connector | ||
|
||
Connect to [Vercel Postgres](https://vercel.com/docs/storage/vercel-postgres) database. | ||
|
||
::alert{type="primary"} | ||
🚀 This connector will be comming soon! Follow up via [unjs/sql0#3](https://github.com/unjs/sql0/issues/3). | ||
:: | ||
|
||
```js | ||
import { createDB, sql } from "sql0"; | ||
import vercelPostgres from "sql0/connectors/vercel-postgres"; | ||
|
||
const db = createDB( | ||
vercelPostgres({ | ||
/* options */ | ||
}) | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Usage | ||
|
||
Discover how to use `sql0` in your project. | ||
|
||
## Installation | ||
|
||
Install [`sql0`](https://npmjs.com/package/sql0) npm package: | ||
|
||
::code-group | ||
|
||
```sh [npm] | ||
npm install sql0 | ||
``` | ||
|
||
```sh [Yarn] | ||
yarn add sql0 | ||
``` | ||
|
||
```sh [pnpm] | ||
pnpm add sql0 | ||
``` | ||
|
||
:: | ||
|
||
## Usage | ||
|
||
```ts | ||
import { createDB, sql } from "sql0"; | ||
import sqlite from "sql0/connectors/better-sqlite3"; | ||
|
||
const db = createDB(sqlite({})); | ||
|
||
await db.exec( | ||
"CREATE TABLE IF NOT EXISTS users (id TEXT PRIMARY KEY, firstName TEXT, lastName TEXT, email TEXT)" | ||
); | ||
|
||
await db.prepare("INSERT INTO users VALUES (?, 'John', 'Doe', '')").run(id); | ||
|
||
const row = await db.prepare("SELECT * FROM users WHERE id = ?").get(id); | ||
|
||
console.log(row); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# HTTP Server | ||
|
||
Expose SQL databases over (secure) HTTP as a restfu API for edge runtimes! | ||
|
||
::alert{type="primary"} | ||
🚀 This feature is planned! Follow up [unjs/sql0#6](https://github.com/unjs/sql0/issues/6) | ||
:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Custom Connector | ||
|
||
If there is no built-in connector yet for a SQL database integration, you can create a custom one by yourself. | ||
|
||
Explore [built-in connectors](https://github.com/unjs/sql0/tree/main/src/conectors) to learn how to implement a custom connector. | ||
|
||
Always feel free to open an issue to [request new connector](https://github.com/unjs/sql0/issues/new?assignees=&labels=connector&projects=&template=feature-request.yml). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default defineNuxtConfig({ | ||
extends: "@nuxt-themes/docus", | ||
modules: ["@nuxtjs/plausible"] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "docus-starter", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "nuxi dev", | ||
"build": "nuxi generate", | ||
"generate": "nuxi generate", | ||
"preview": "nuxi preview" | ||
}, | ||
"devDependencies": { | ||
"@nuxt-themes/docus": "^1.12.0", | ||
"@nuxtjs/plausible": "^0.2.1", | ||
"nuxt": "^3.5.0" | ||
} | ||
} |
Oops, something went wrong.
16922ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sql0 – ./
sql0-git-main-nuxt-js.vercel.app
sql0.vercel.app
sql0-nuxt-js.vercel.app