open-index/open-npm huggingface dataset:
npm package: @pomgui/database-firebird
Description: Library to handle Firebird database connections using Promises and allowing named parameters
Author: Wilfredo Pomier
Latest version: 1.0.0

# Firebird Database library

[![Package Version][package-image]][package-url]
[![Open Issues][issues-image]][issues-url]

@pomgui/database-firebird is a typescript library that provides an interface to execute the normal operations
with a client [node-firebird](https://www.npmjs.com/package/node-firebird)
database driver as connect, start transaction, commit, etc.

## Advantages:

- All methods return promises.
- It uses query parameters like `:id` instead of `?`.
- The parameters understand object's hierarchy, so it understands parameters like `:entry.id`.
- The returned rows also are preprocessed to return nested objects if needed (See Usage Example section).
- It maintains the same interface ([@pomgui/database][base-url]) no matter the database, so it helps with the migration from different databases E.g. MySQL to Firebird or to PostgreSQL and vice versa
  (See [@pomgui/database-mysql][database-mysql-url] usage example and compare)

## Installation

Use npm to install the library.

```bash
npm install @pomgui/database-firebird --save
```

## Usage Example

```typescript
import { PiFirebirdPool } from '@pomgui/database-firebird';

const options = {
    host: 'localhost',
    port: 3050,
    user: 'sysdba',
    password: 'masterkey',
    database: 'test.fdb'
};

async work(){
    const pool = new PiFirebirdPool(options, 10);
    const db = await pool.get();
    await db.beginTransaction();
    try{
        const param = {entry: {id: 3}};
        const data = await db.query(`
            SELECT 
                e.entry_id "id", e.entry_date, 
                b.benef_id "benef.id", b.name "benef.name"
            FROM ENTRIES e JOIN BENEFICIARIES db ON b.benef_id = e.benef_id
            WHERE entry_id >= :entry.id
            LIMIT 0,10`, param);
        console.log(data);
        await db.commit();
    }catch(err){
        console.error(err);
        await db.rollback();
    }finally{
        await db.close();
    }
}
```

This will print:

```javascript
[{  id: 3, 
    entryDate: 2020-08-01T00:00:00.000Z,
    benef: {
        id: 1,
        name: 'John Doe'
    }
},{  id: 4, 
    date: 2020-08-02T00:00:00.000Z,
    benef: {
        id: 1,
        name: 'Jane Doe'
    }
}, ...
]
```




[base-url]: https://www.npmjs.com/package/@pomgui/database
[project-url]: https://github.com/pomgui/database-firebird
[database-mysql-url]: https://www.npmjs.com/package/@pomgui/database-mysql
[package-image]: https://badge.fury.io/js/@pomgui%2Fdatabase-firebird.svg
[package-url]: https://badge.fury.io/js/@pomgui%2Fdatabase-firebird
[issues-image]: https://img.shields.io/github/issues/pomgui/database-firebird.svg?style=popout
[issues-url]: https://github.com/pomgui/database-firebird/issues
npm package: @pomgui/database-mysql
Description: Library to handle Mysql database connections using Promises and allowing named parameters
Author: Wilfredo Pomier
Latest version: 1.0.0

# MySQL Database library

[![Package Version][package-image]][package-url]
[![Open Issues][issues-image]][issues-url]

@pomgui/database-mysql is a typescript library that provides an interface to execute the normal operations
with a client [mysql](https://www.npmjs.com/package/mysql) 
database driver as connect, start transaction, commit, etc.

## Advantages:

- All methods return promises.
- It uses query parameters like `:id` instead of `?`.
- The parameters understand object's hierarchy, so it understands parameters like `:entry.id`.
- The returned rows also are preprocessed to return nested objects if needed (See Usage Example section).
- It maintains the same interface ([@pomgui/database][base-url]) no matter the database, so it helps with the migration from different databases E.g. MySQL to Firebird or to PostgreSQL and vice versa
  (See [@pomgui/database-pg][database-pg-url] usage example and compare)

## Installation

Use npm to install the library.

```bash
npm install @pomgui/database-mysql --save
```

## Usage Example

```typescript
const options = {
    host: 'localhost',
    user: 'user',
    password: 'secret',
    database: 'test'
};

async work(){
    const pool = new PiMySqlPool(options, 10);
    const db = await pool.get();
    await db.beginTransaction();
    try{
        const param = {entry: {id: 3}};
        const data = await db.query(`
            SELECT 
                e.entry_id "id", e.entry_date, 
                b.benef_id "benef.id", b.name "benef.name"
            FROM ENTRIES e JOIN BENEFICIARIES db ON b.benef_id = e.benef_id
            WHERE entry_id >= :entry.id
            LIMIT 0,10`, param);
        console.log(data);
        await db.commit();
    }catch(err){
        console.error(err);
        await db.rollback();
    }finally{
        await db.close();
    }
}
```

This will print:

```javascript
[{  id: 3, 
    entryDate: 2020-08-01T00:00:00.000Z,
    benef: {
        id: 1,
        name: 'John Doe'
    }
},{  id: 4, 
    date: 2020-08-02T00:00:00.000Z,
    benef: {
        id: 1,
        name: 'Jane Doe'
    }
}, ...
]
```




[base-url]: https://www.npmjs.com/package/@pomgui/database
[project-url]: https://github.com/pomgui/database-mysql
[database-pg-url]: https://www.npmjs.com/package/@pomgui/database-pg
[package-image]: https://badge.fury.io/js/@pomgui%2Fdatabase-mysql.svg
[package-url]: https://badge.fury.io/js/@pomgui%2Fdatabase-mysql
[issues-image]: https://img.shields.io/github/issues/pomgui/database-mysql.svg?style=popout
[issues-url]: https://github.com/pomgui/database-mysql/issues
npm package: @pomgui/database-pg
Description: Library to handle PostgreSQL database connections allowing named parameters
Author: Wilfredo Pomier
Latest version: 1.0.5

# PosgreSQL Database library

[![Package Version][package-image]][package-url]
[![Open Issues][issues-image]][issues-url]

@pomgui/database-pg is a typescript library that provides an interface to execute the normal operations
with a client [pg](https://www.npmjs.com/package/pg) 
database driver as connect, start transaction, commit, etc.

## Advantages:

- All methods return promises.
- It uses query parameters like `:id` instead of `?`.
- The parameters understand object's hierarchy, so it understands parameters like `:entry.id`.
- The returned rows also are preprocessed to return nested objects if needed (See Usage Example section).
- It maintains the same interface ([@pomgui/database][base-url]) no matter the database, so it helps with the migration from different databases E.g. MySQL to Firebird or to PostgreSQL and vice versa
  (See [@pomgui/database-mysql][database-mysql-url] usage example and compare)

## Installation

Use npm to install the library.

```bash
npm install @pomgui/database-pg --save
```

## Usage Example

```typescript
import { PiPgPool } from '@pomgui/database-pg';

const options = {
    connectionString: 'user:pass@host:5432/database'
};

async work(){
    const pool = new PiPgPool(options, 10);
    const db = await pool.get();
    await db.beginTransaction();
    try{
        const param = {entry: {id: 3}};
        const data = await db.query(`
            SELECT 
                e.entry_id "id", e.entry_date, 
                b.benef_id "benef.id", b.name "benef.name"
            FROM ENTRIES e JOIN BENEFICIARIES db ON b.benef_id = e.benef_id
            WHERE entry_id >= :entry.id
            LIMIT 10`, param);
        console.log(data);
        await db.commit();
    }catch(err){
        console.error(err);
        await db.rollback();
    }finally{
        await db.close();
    }
}
```

This will print:

```javascript
[{  id: 3, 
    entryDate: 2020-08-01T00:00:00.000Z,
    benef: {
        id: 1,
        name: 'John Doe'
    }
},{  id: 4, 
    date: 2020-08-02T00:00:00.000Z,
    benef: {
        id: 1,
        name: 'Jane Doe'
    }
}, ...
]
```




[base-url]: https://www.npmjs.com/package/@pomgui/database
[project-url]: https://github.com/pomgui/database-pg
[database-mysql-url]: https://www.npmjs.com/package/@pomgui/database-mysql
[package-image]: https://badge.fury.io/js/@pomgui%2Fdatabase-pg.svg
[package-url]: https://www.npmjs.com/package/@pomgui/database-pg
[issues-image]: https://img.shields.io/github/issues/pomgui/database-pg.svg?style=popout
[issues-url]: https://github.com/pomgui/database-pg/issues
npm package: @pomgui/deep
Description: Ultrasmall footprint deepmerge, deepfreeze, diff, patch tools
Author: Wilfredo Pomier
Latest version: 3.0.3

# Deep

Ultra small footprint merge & freeze methods.

### deepMerge
This method is like `assign` except that it recursively merges own and
inherited enumerable string keyed properties of source objects into the
destination object. Source properties that resolve to `undefined` are
skipped if a destination value exists. Array and plain object properties
are merged recursively. Other objects and value types are overridden by
assignment. Source objects are applied from left to right. Subsequent
sources overwrite property assignments of previous sources.

For the most cases it is compatible with 
[lodash.merge](https://www.npmjs.com/package/lodash.merge) package.

### deepFreeze
This method executes an recursive Object.freeze.

### diff
Compares two JSON objects and returns the delta (difference), optimizing bandwidth usage—ideal for PATCH requests in REST services.

### patch
Takes the diff's result and applies it into a JSON object, reconstructing the most recent version.

## Installation

Using npm:
```bash
$ {sudo -H} npm i -g npm
$ npm i --save @pomgui/deep
```

In Node.js:
```js
var { deepMerge } = require('@pomgui/deep');
```

With typescript:
 ```typescript
import { deepMerge } from '@pomgui/deep';
import { diff, patch } from '@pomgui/deep';
```

## Usage

### deepMerge

```js
const object = {
  'a': [{ 'b': 2 }, { 'd': 4 }]
}
const other = {
  'a': [{ 'c': 3 }, { 'e': 5 }]
}
deepMerge(object, other)
// => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }

### deepFreeze

const frozen = deepFreeze(obj);
// frozen === obj

const frozenArr = deepFreeze(obj1, obj2, obj3);
// frozenArr[0] === obj1
// frozenArr[1] === obj2
// frozenArr[2] === obj3

```

### diff & patch

```js
const a = {
  foo: {
    bar: {
      a: ["a", "b"],
      b: 2,
      c: ["x", "y"],
      e: 100,
    },
  },
  buzz: "world",
};

const b = {
  foo: {
    bar: {
      a: ["a"],
      b: 2,
      c: ["x", "y", "z"],
      d: "Hello, world!",
    },
  },
  buzz: "fizz",
};

expect(patch(a, diff(a, b))).toEqual(b);
```