Skip to content

Commit 87fe60f

Browse files
committed
GH Pages refinement
1 parent 62fe0b5 commit 87fe60f

File tree

18 files changed

+2799
-0
lines changed

18 files changed

+2799
-0
lines changed

docs2/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
redirect_to: ./index.md
3+
---

docs2/_config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
title: LinkedQL
2+
description: SQL, evolved — A reactive, version-aware database client.
3+
plugins:
4+
- jekyll-seo-tag
5+
- jekyll-sitemap
6+
markdown: GFM
7+
url: "https://linked-db.github.io"
8+
baseurl: "/linked-ql"

docs2/entry/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
redirect_to: ./index.md
3+
---

docs2/entry/api.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: "The Query Interface"
3+
description: "The LinkedQL query interface"
4+
permalink: /entry/api/
5+
nav_order: 4
6+
layout: page
7+
---
8+
9+
# Query Interface
10+
11+
LinkedQL provides a **unified** query interface across all dialects.
12+
13+
---
14+
15+
## `2.1 |` `client.query()`
16+
17+
Primary query API supporting multiple input shapes.
18+
19+
```js
20+
// String query only
21+
const result = await client.query('SELECT * FROM users');
22+
23+
// Query with parameters array
24+
const result = await client.query('SELECT * FROM users WHERE active = $1', [true]);
25+
26+
// Query with parameters and options
27+
const result = await client.query(
28+
'SELECT * FROM users WHERE created_at > $1',
29+
[new Date('2024-01-01')],
30+
{ live: true }
31+
);
32+
33+
// Parameters passed through options.values
34+
const result = await client.query(
35+
'SELECT * FROM users WHERE name = $1',
36+
{ values: ['John'], cache: true }
37+
);
38+
```
39+
40+
---
41+
42+
## `2.2 |` `Result`
43+
44+
Every query returns a `result` object exposing `.rows` and `.rowCount` (alias `.affectedRows`).
45+
46+
```js
47+
// SELECT queries
48+
const result = await client.query('SELECT id, name, email FROM users');
49+
console.log(result.rows); // [{ id: 1, name: 'John', email: 'john@example.com' }]
50+
console.log(result.rowCount); // 0 (SELECT never affects rows)
51+
```
52+
53+
```js
54+
// INSERT with RETURNING
55+
const result = await client.query(
56+
'INSERT INTO users (name) VALUES ($1) RETURNING *',
57+
['Alice']
58+
);
59+
console.log(result.rows); // [{ id: 2, name: 'Alice' }]
60+
console.log(result.rowCount); // 0 (.rowCount only applies to non-returning writes)
61+
```
62+
63+
```js
64+
// INSERT without RETURNING
65+
const result = await client.query('INSERT INTO users (name) VALUES ($1)', ['Bob']);
66+
console.log(result.rowCount); // 1 (one row affected)
67+
console.log(result.rows); // [] (no result set)
68+
```

docs2/entry/clients.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
---
2+
title: "Clients and Dialects"
3+
description: "The LinkedQL clients and dialects"
4+
permalink: /entry/clients/
5+
nav_order: 4
6+
layout: page
7+
---
8+
9+
# Dialects & Clients
10+
11+
LinkedQL ships with clients for each major SQL dialect.
12+
13+
Each LinkedQL client extends its respective native connector and accepts the same initialization options.
14+
The PostgreSQL, MySQL, and MariaDB clients integrate directly with their native drivers, while **FlashQL** provides an in-memory SQL engine that speaks both dialects.
15+
16+
---
17+
18+
## `1.1 |` PostgreSQL
19+
20+
Use as a drop-in replacement for [`node-postgres`](https://www.npmjs.com/package/pg).<br>
21+
Speaks native **PostgreSQL**.
22+
23+
```js
24+
import { PGClient } from '@linked-db/linked-ql/pg';
25+
26+
const client = new PGClient({
27+
host: 'localhost',
28+
port: 5432,
29+
user: 'postgres',
30+
password: 'password',
31+
database: 'mydb',
32+
poolMode: false // defaults to pg.Client
33+
});
34+
await client.connect();
35+
36+
const res = await client.query('SELECT 1::text AS result');
37+
console.log(res.rows); // [{ result: '1' }]
38+
39+
await client.disconnect();
40+
```
41+
42+
### `1.1.1 |` Client Options
43+
44+
`PGClient` accepts all options supported by `node-postgres`.
45+
46+
Additional options:
47+
48+
* **`poolMode`** (*Default*: `false`) — whether to connect over `pg.Pool` or `pg.Client`.
49+
50+
### `1.1.2 |` Realtime Setup
51+
52+
To enable **live queries**, ensure [logical replication](https://www.postgresql.org/docs/current/view-pg-replication-slots.html) is enabled on your database.
53+
54+
Optionally specify the following to adapt LinkedQL to your setup:
55+
56+
* **`walSlotName`** — (*Default*: `'linkedql_default_slot'`) replication slot name.
57+
* **`walSlotPersistence`** — slot lifecycle management:<br>
58+
`0` = ephemeral, DB-managed · `1` = ephemeral, LinkedQL-managed · `2` = persistent, external management implied.
59+
* **`pgPublications`** — (*Default*: `'linkedql_default_publication'`) publication name(s) to listen on.
60+
61+
---
62+
63+
## `1.2 |` MySQL
64+
65+
Use in place of [`mysql2`](https://www.npmjs.com/package/mysql2).
66+
Speaks native **MySQL**.
67+
68+
```js
69+
import { MySQLClient } from '@linked-db/linked-ql/mysql';
70+
71+
const client = new MySQLClient({
72+
host: 'localhost',
73+
port: 3306,
74+
user: 'root',
75+
password: 'password',
76+
database: 'mydb',
77+
poolMode: false // defaults to mysql.createConnection()
78+
});
79+
await client.connect();
80+
81+
const res = await client.query('SELECT 1 AS `result`');
82+
console.log(res.rows); // [{ result: 1 }]
83+
84+
await client.disconnect();
85+
```
86+
87+
### `1.2.1 |` Client Options
88+
89+
`MySQLClient` accepts all connection options supported by `mysql2`.
90+
91+
Additional options:
92+
93+
* **`poolMode`** (*Default*: `false`) — whether to connect over `mysql.createPool()` or `mysql.createConnection()`.
94+
95+
### `1.2.2 |` Realtime Setup
96+
97+
Realtime capabilities for MySQL are **coming soon**.
98+
99+
---
100+
101+
## `1.3 |` MariaDB
102+
103+
Use in place of [`mariadb`](https://www.npmjs.com/package/mariadb`).<br>
104+
Speaks native **MariaDB / MySQL**.
105+
106+
```js
107+
import { MariaDBClient } from '@linked-db/linked-ql/mariadb';
108+
109+
const client = new MariaDBClient({
110+
host: 'localhost',
111+
port: 3306,
112+
user: 'root',
113+
password: 'password',
114+
database: 'mydb'
115+
});
116+
await client.connect();
117+
118+
const res = await client.query('SELECT 1 AS `result`');
119+
console.log(res.rows); // [{ result: 1 }]
120+
121+
await client.disconnect();
122+
```
123+
124+
### `1.3.1 |` Client Options
125+
126+
`MariaDBClient` accepts all connection options supported by the native `mariadb` driver.<br>
127+
It always runs on a connection pool.
128+
129+
### `1.3.2 |` Realtime Setup
130+
131+
Realtime support for MariaDB is **coming soon**.
132+
133+
---
134+
135+
## `1.4 |` FlashQL
136+
137+
Use as an in-memory alternative to [`SQLite`](https://sqlite.org/) or [`PGLite`](https://pglite.dev/).
138+
Speaks both **PostgreSQL** and **MySQL** dialects.
139+
140+
```js
141+
import { FlashClient } from '@linked-db/linked-ql/flash';
142+
143+
const client = new FlashClient();
144+
await client.connect();
145+
146+
// PostgreSQL syntax (default dialect)
147+
const pgRes = await client.query('SELECT 1::text AS result');
148+
console.log(pgRes.rows); // [{ result: '1' }]
149+
150+
// MySQL syntax (explicit dialect)
151+
const myRes = await client.query('SELECT 1 AS `result`', { dialect: 'mysql' });
152+
console.log(myRes.rows); // [{ result: 1 }]
153+
154+
await client.disconnect();
155+
```
156+
157+
### `1.4.1 |` Realtime Setup
158+
159+
Realtime capabilities are built in.
160+
No configuration required — FlashQL automatically emits and processes change events internally.

docs2/entry/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: "Entry Layer"
3+
description: "The interface layer that accepts SQL via .query(), routes it through the system, and connects to PostgreSQL, MySQL, MariaDB, and FlashQL."
4+
permalink: /entry/
5+
nav_order: 1
6+
layout: page
7+
---
8+
9+
# Entry Layer (`entry`)
10+
11+
The entry layer defines the interface between the user and the LinkedQL runtime.
12+
It handles incoming SQL through `.query()`, orchestrates its passage through the Language and Processing layers,
13+
and returns live results via dialect-specific clients.
14+
15+
+ [API (`api`)](api) — the query interface.
16+
+ [Clients (`clients`)](clients) — clients and dialects.

docs2/flash/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
redirect_to: ./index.md
3+
---

0 commit comments

Comments
 (0)