Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
G4brym committed Nov 23, 2024
1 parent 98b8af4 commit 69e6ed3
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 11 deletions.
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ Currently, 3 databases are supported:

## Features

- [x] Zero dependencies.
- [x] Zero dependencies
- [x] Fully typed/TypeScript support
- [x] [Migrations](https://workers-qb.massadas.com/migrations/)
- [x] [Type Checks for data read](https://workers-qb.massadas.com/type-check/)
- [x] [Create/drop tables](https://workers-qb.massadas.com/basic-queries/#dropping-and-creating-tables)
- [x] [Insert/Bulk Inserts/Update/Select/Delete/Join queries](https://workers-qb.massadas.com/basic-queries/)
- [x] [Modular selects](https://workers-qb.massadas.com/modular-selects/)
- [x] [Modular selects](https://workers-qb.massadas.com/modular-selects/) (qb.select(...).where(...).where(...).one())
- [x] [On Conflict for Inserts and Updates](https://workers-qb.massadas.com/advanced-queries/onConflict/)
- [x] [Upsert](https://workers-qb.massadas.com/advanced-queries/upsert/)

Expand All @@ -40,7 +41,7 @@ npm install workers-qb --save
import { D1QB } from 'workers-qb'

export interface Env {
DB: any
DB: D1Database
}

export default {
Expand All @@ -65,7 +66,7 @@ export default {
.execute()

// Or in a modular approach
const employeeList = await qb.select<Employee>('employees').where('active = ?', true).execute()
const employeeListModular = await qb.select<Employee>('employees').where('active = ?', true).execute()

// You get IDE type hints on each employee data, like:
// employeeList.results[0].name
Expand All @@ -77,6 +78,26 @@ export default {
}
```

## Example for Cloudflare Durable Objects

```ts
import { DOQB } from 'workers-qb'

export class DOSRS extends DurableObject {
getEmployees() {
const qb = new DOQB(this.ctx.storage.sql)

const fetched = qb
.fetchAll({
tableName: 'employees',
})
.execute()

return fetched.results
}
}
```

## Example for Cloudflare Workers with PostgreSQL

Remember to close the connection using `ctx.waitUntil(qb.close());` or `await qb.close();` at the end of your request.
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/databases/cloudflare-d1.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ database_id = "<unique-ID-for-your-database>"
import { D1QB } from 'workers-qb'

export interface Env {
DB: any
DB: D1Database
}

export default {
Expand Down Expand Up @@ -57,7 +57,7 @@ run.
import { D1QB } from 'workers-qb'

export interface Env {
DB: any
DB: D1Database
}

export default {
Expand Down
25 changes: 22 additions & 3 deletions docs/pages/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
## Installation

```
npm install workers-qb --save
Expand All @@ -10,7 +9,7 @@ npm install workers-qb --save
import { D1QB } from 'workers-qb'

export interface Env {
DB: any
DB: D1Database
}

export default {
Expand All @@ -35,7 +34,7 @@ export default {
.execute()

// Or in a modular approach
const employeeList = await qb.select<Employee>('employees').where('active = ?', true).execute()
const employeeListModular = await qb.select<Employee>('employees').where('active = ?', true).execute()

// You get IDE type hints on each employee data, like:
// employeeList.results[0].name
Expand All @@ -47,6 +46,26 @@ export default {
}
```

## Example for Cloudflare Durable Objects

```ts
import { DOQB } from 'workers-qb'

export class DOSRS extends DurableObject {
getEmployees() {
const qb = new DOQB(this.ctx.storage.sql)

const fetched = qb
.fetchAll({
tableName: 'employees',
})
.execute()

return fetched.results
}
}
```

## Example for Cloudflare Workers with PostgreSQL

Remember to close the connection using `ctx.waitUntil(qb.close());` or `await qb.close();` at the end of your request.
Expand Down
5 changes: 3 additions & 2 deletions docs/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ Currently, 3 databases are supported:

## Features

- [x] Zero dependencies.
- [x] Zero dependencies
- [x] Fully typed/TypeScript support
- [x] [Migrations](https://workers-qb.massadas.com/migrations/)
- [x] [Type Checks for data read](https://workers-qb.massadas.com/type-check/)
- [x] [Create/drop tables](https://workers-qb.massadas.com/basic-queries/#dropping-and-creating-tables)
- [x] [Insert/Bulk Inserts/Update/Select/Delete/Join queries](https://workers-qb.massadas.com/basic-queries/)
- [x] [Modular selects](https://workers-qb.massadas.com/modular-selects/)
- [x] [Modular selects](https://workers-qb.massadas.com/modular-selects/) (qb.select(...).where(...).where(...).one())
- [x] [On Conflict for Inserts and Updates](https://workers-qb.massadas.com/advanced-queries/onConflict/)
- [x] [Upsert](https://workers-qb.massadas.com/advanced-queries/upsert/)

0 comments on commit 69e6ed3

Please sign in to comment.