like-rqlite
RQLite wrapper for Node.js
npm i like-rqlite
Warning: This is highly experimental, and API will be breaking until v1.
Usage
const RQLite = require('like-rqlite')
const db = new RQLite('http://127.0.0.1:4001', 'root', 'secret', 'main')
const id = await db.insert('ips', { addr: req.ip, hits: 0 })
const rows = await db.select('ips', ['addr', 'hits'], 'addr = ?', req.ip)
const row = await db.selectOne('ips', ['addr', 'hits'], 'addr = ?', req.ip)
const exists = await db.exists('ips', 'addr = ?', req.ip)
const count = await db.count('ips', 'addr = ?', req.ip)
await db.update('ips', { hits: 1 }, 'addr = ?', req.ip)
await db.update('ips', [{ hits: 'hits + ?' }, 1], 'addr = ?', req.ip)
await db.delete('ips', 'addr = ?', req.ip)
const [res, fields] = await db.execute('SELECT * FROM `ips` WHERE `addr` = ?', [req.ip])
const [rows, fields] = await db.query('SELECT * FROM `ips` WHERE `addr` = "8.8.8.8"')
License
Unlicensed