Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rqlite-fp

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rqlite-fp

A client library for rqlite in function programming style

  • 2.9.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
increased by142.86%
Maintainers
1
Weekly downloads
 
Created
Source

rqlite-fp

Build Status David DM GitHub code size in bytes GitHub package.json version GitHub

A client library for rqlite in a functional programming style

Installation

npm install --save rqlite-fp

Example

With callbacks

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

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.

Keywords

FAQs

Package last updated on 20 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc