# rqlite-fp

> A client library for rqlite in function programming style

Latest version **2.10.1** (published 2020-08-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install rqlite-fp
pnpm add rqlite-fp
yarn add rqlite-fp
bun add rqlite-fp
```

## 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 | 2.10.1 |
| Published | 2020-08-13 |
| First published | 2020-05-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 25.3 KB |
| Known vulnerabilities | 0 (+12 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | markwylde |
| Keywords | rqlite, memory, rdbms, db, database, sql, functional |

## Links

- npm: https://www.npmjs.com/package/rqlite-fp
- Repository: https://github.com/markwylde/rqlite-fp
- Homepage: https://github.com/markwylde/rqlite-fp#readme
- Issues: https://github.com/markwylde/rqlite-fp/issues
- npm.io page: https://npm.io/package/rqlite-fp

## Dependencies (7)

- [tar](https://npm.io/package/tar.md) ^6.0.2
- [chalk](https://npm.io/package/chalk.md) ^4.0.0
- [righto](https://npm.io/package/righto.md) ^6.1.1
- [callarest](https://npm.io/package/callarest.md) ^2.0.1
- [sqlstring](https://npm.io/package/sqlstring.md) ^2.3.2
- [follow-redirects](https://npm.io/package/follow-redirects.md) ^1.11.0
- [calladownload-extract](https://npm.io/package/calladownload-extract.md) ^1.2.0

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [@temporal-architect/claude-plugin](https://npm.io/package/@temporal-architect/claude-plugin.md) — 335 weekly downloads

## Recent versions

- 2.10.1 (latest) — 2020-08-13
- 2.10.0 — 2020-08-13
- 2.9.0 — 2020-06-20
- 2.8.1 — 2020-06-14
- 2.8.0 — 2020-06-14
- 2.7.2 — 2020-06-03
- 2.7.1 — 2020-06-03
- 2.7.0 — 2020-05-31
- 2.6.0 — 2020-05-31
- 2.5.0 — 2020-05-31
- 2.4.0 — 2020-05-31
- 2.2.0 — 2020-05-25
- 2.1.1 — 2020-05-24
- 2.1.0 — 2020-05-23
- 2.0.0 — 2020-05-23

## README

# rqlite-fp
[![Build Status](https://travis-ci.org/markwylde/rqlite-fp.svg?branch=master)](https://travis-ci.org/markwylde/rqlite-fp)
[![David DM](https://david-dm.org/markwylde/rqlite-fp.svg)](https://david-dm.org/markwylde/rqlite-fp)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/markwylde/rqlite-fp)
[![GitHub package.json version](https://img.shields.io/github/package-json/v/markwylde/rqlite-fp)](https://github.com/markwylde/rqlite-fp/releases)
[![GitHub](https://img.shields.io/github/license/markwylde/rqlite-fp)](https://github.com/markwylde/rqlite-fp/blob/master/LICENSE)

A client library for rqlite in a functional programming style

## Installation
```bash
npm install --save rqlite-fp
```

## Example
### With promises
```javascript
const rqlite = require('rqlite-fp/promises');

(async function () {
  const connection = await connect('http://localhost:4001')
  const tableCreated = await execute(connection, 'CREATE TABLE lorem (info TEXT)')
  const testResults = await getAll(connection, 'SELECT * FROM test')

  console.log(results)
}())
```

### With callbacks
```javascript
const connect = require('rqlite-fp/connect')
const execute = require('rqlite-fp/execute')
const getAll = require('rqlite-fp/getAll')

function getTestRecords (callback) {
  connect('http://localhost:4001', function (error, connection) {
    if (error) { return callback(error) }
    execute(connection, 'CREATE TABLE lorem (info TEXT)', function (error, tableCreated) {
      if (error) { return callback(error) }
      getAll(connection, 'SELECT * FROM test', function (error, testResults) {
        if (error) { return callback(error) }
        callback(null, testResults)
      })
    })
  })
}

getTestRecords(function (error, testRecords) {
  if (error) {
    throw error
  }
  console.log(testRecords)
})
```

### With [righto](https://github.com/KoryNunn/righto)
```javascript
const righto = require('righto')
const connect = require('rqlite-fp/connect')
const execute = require('rqlite-fp/execute')
const getAll = require('rqlite-fp/getAll')

const connection = righto(connect, 'http://localhost:4001')
const tableCreated = righto(execute, connection, 'CREATE TABLE lorem (info TEXT)')
const testResults = righto(getAll, connection, 'SELECT * FROM test', righto.after(tableCreated))

testResults(function (error, results) {
  if (error) {
    throw error
  }

  console.log(results)
})
```

## Functions signatures
### start -> {httpAddr, raftAddr, join} -> (error, connection)
### connect -> filename -> [mode] -> (error, connection)
### run -> connection -> sql -> [parameters] -> (error, result={lastId, changes})
### getAll -> connection -> sql -> (error, rows)
### getOne -> connection -> sql -> (error, row)
### batch -> connection -> sql -> [[parameters]] -> (error, result={lastId, changes})
### execute -> connection -> sql -> (error, connection)
### close -> connection -> (error)

## License
This project is licensed under the terms of the MIT license.

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