nukak-express
Advanced tools
Comparing version 0.2.24 to 0.2.25
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "0.2.24", | ||
"version": "0.2.25", | ||
"type": "module", | ||
@@ -27,3 +27,3 @@ "main": "./index.js", | ||
"rimraf": "^5.0.1", | ||
"typescript": "^5.1.3" | ||
"typescript": "^5.1.5" | ||
}, | ||
@@ -30,0 +30,0 @@ "author": "Roger Padilla", |
@@ -66,25 +66,4 @@ <!--  --> | ||
## Configure | ||
--- | ||
A default querier-pool can be set in any of the bootstrap files of your app (e.g. in the `server.ts`). | ||
```ts | ||
import { setQuerierPool } from 'nukak'; | ||
import { PgQuerierPool } from 'nukak-postgres'; | ||
export const querierPool = new PgQuerierPool( | ||
{ | ||
host: 'localhost', | ||
user: 'theUser', | ||
password: 'thePassword', | ||
database: 'theDatabase', | ||
}, | ||
// optionally, a logger can be passed to log the generated SQL queries | ||
{ logger: console.log } | ||
); | ||
// the default querier pool that `nukak` will use | ||
setQuerierPool(querierPool); | ||
``` | ||
| ||
@@ -131,2 +110,27 @@ | ||
## Setup a default querier-pool | ||
A default querier-pool can be set in any of the bootstrap files of your app (e.g. in the `server.ts`). | ||
```ts | ||
import { setQuerierPool } from 'nukak'; | ||
import { PgQuerierPool } from 'nukak-postgres'; | ||
export const querierPool = new PgQuerierPool( | ||
{ | ||
host: 'localhost', | ||
user: 'theUser', | ||
password: 'thePassword', | ||
database: 'theDatabase', | ||
}, | ||
// optionally, a logger can be passed to log the generated SQL queries | ||
{ logger: console.log } | ||
); | ||
// the default querier pool that `nukak` will use | ||
setQuerierPool(querierPool); | ||
``` | ||
| ||
## Manipulate the data | ||
@@ -138,3 +142,3 @@ | ||
async function findLastUsers(limit = 10) { | ||
async function findFirstUsers(limit = 100) { | ||
const querier = await getQuerier(); | ||
@@ -144,3 +148,3 @@ const users = await querier.findMany( | ||
{ | ||
$sort: { createdAt: -1 }, | ||
$sort: { createdAt: 1 }, | ||
$limit: limit, | ||
@@ -147,0 +151,0 @@ }, |
Sorry, the diff of this file is not supported yet
81627
165