# @diary-spo/sql

> sql helper

Latest version **1.2.2** (published 2024-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @diary-spo/sql
pnpm add @diary-spo/sql
yarn add @diary-spo/sql
bun add @diary-spo/sql
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2024-01-08 |
| First published | 2023-11-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | scffs |
| Maintainers | scffs |
| Keywords | sql |

## Links

- npm: https://www.npmjs.com/package/@diary-spo/sql
- Repository: https://github.com/Diary-SPO/sql
- Homepage: https://github.com/Diary-SPO/sql#readme
- Issues: https://github.com/Diary-SPO/sql/issues
- npm.io page: https://npm.io/package/@diary-spo/sql

## Dependencies (2)

- [crypto](https://npm.io/package/crypto.md) ^1.0.1
- [node-fetch](https://npm.io/package/node-fetch.md) ^3.3.2

## Recent versions

- 1.2.2 (latest) — 2024-01-08
- 1.2.1 — 2024-01-08
- 1.2.0 — 2023-11-26
- 1.1.6 — 2023-11-26
- 1.1.5 — 2023-11-23
- 1.1.4 — 2023-11-18
- 1.1.3 — 2023-11-18
- 1.1.2 — 2023-11-18
- 1.1.1 — 2023-11-18
- 1.1.0 — 2023-11-18
- 1.0.0 — 2023-11-17

## README

# @diary-spo/sql

# Установка

```bash
npm install @diary-spo/sql
```

```bash
yarn add @diary-spo/sql
```

```bash
bun add @diary-spo/sql
```

# Использование

### SQL builder

```ts
import { createQueryBuilder, executeQuery } from '@diary-spo/sql'
import { Client } from 'pg'

/* инициализация вашего клиента базы данных */
const client = new Client({})
await client.connect()

const queryBuilder = createQueryBuilder(client)

// Пример использования
const result = await queryBuilder
  .from('имя_вашей_таблицы')
  .select('колонка1', 'колонка2')
  .where('ваше_условие')
  .all()

console.log(result)
```

### Шифрование

```ts
import { encrypt, decrypt, buildValuesString } from '@diary-spo/sql'

// Пример использования
const ENCRYPT_KEY = 'ваш_ключ_шифрования'
const originalString = 'ваша_исходная_строка'

const encryptedValue = encrypt(originalString, ENCRYPT_KEY)
console.log('Зашифрованное Значение:', encryptedValue)

const decryptedValue = decrypt(encryptedValue, ENCRYPT_KEY)
console.log('Расшифрованное Значение:', decryptedValue)
```

---
_Source: https://npm.io/package/@diary-spo/sql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
