# jasql

> JSON document storage in SQL

Latest version **0.4.3** (published 2016-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install jasql
pnpm add jasql
yarn add jasql
bun add jasql
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.3 |
| Published | 2016-09-02 |
| First published | 2016-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | codyzu |
| Maintainers | codyzu |
| Keywords | json, mysql, postgres, postgresql, sql, sqlite, database |

## Links

- npm: https://www.npmjs.com/package/jasql
- Repository: https://github.com/codyzu/jasql
- Homepage: https://codyzu.github.io/jasql
- Issues: https://github.com/codyzu/jasql/issues
- npm.io page: https://npm.io/package/jasql

## Dependencies (6)

- [pg](https://npm.io/package/pg.md) ^6.0.1
- [knex](https://npm.io/package/knex.md) ^0.11.7
- [mysql](https://npm.io/package/mysql.md) ^2.11.1
- [lodash](https://npm.io/package/lodash.md) ^4.13.1
- [shortid](https://npm.io/package/shortid.md) ^2.2.6
- [sqlite3](https://npm.io/package/sqlite3.md) ^3.1.4

## Recent versions

- 0.4.3 (latest) — 2016-09-02
- 0.5.0-beta.0 (beta) — 2016-09-02
- 0.4.2 — 2016-07-17
- 0.4.1 — 2016-07-14
- 0.4.0 — 2016-07-14
- 0.3.4 — 2016-07-13
- 0.3.3 — 2016-07-13
- 0.3.2 — 2016-07-13
- 0.3.1 — 2016-07-13
- 0.3.0 — 2016-07-11
- 0.2.1 — 2016-07-10
- 0.1.1 — 2016-07-10

## README

# jasql - JSON document storage in SQL for node.js

## ![jasql](resources/logo-200px.png) node.js + JSON + SQL = bliss

[![Build Status](https://travis-ci.org/codyzu/jasql.svg?branch=master)](https://travis-ci.org/codyzu/jasql)
[![Coverage Status](https://coveralls.io/repos/github/codyzu/jasql/badge.svg?branch=master)](https://coveralls.io/github/codyzu/jasql?branch=master)

jasql is a node.js storage library for storing schemaless documents in various relational databases.
Built on knex, jasql supports sqlite3, postgres, mysql, ~~oracle~~, and ~~mssql~~.
The API is heavily inspired by pouchdb and is intuitive and designed to be rapidly used in applications exporting REST APIs.

_support for the missing databases above is coming soon!_

## :sparkles: [Click here for the jasql website including complete documentation, examples, and tips.](https://codyzu.github.io/jasql) :sparkles:

# Quickstart

### 1. Install jasql:

jasql is [available on npm](https://www.npmjs.com/package/jasql) and is easy to install.

```
npm install jasql
```

### 2. Do stuff:

```javascript
const Jasql = require('jasql')
const jasql = new Jasql()

jasql.initialize()
  .then(() => console.log('jasql is ready to work!'))

  // CREATE some documents

  // first create 2 users
  .then(() => jasql.create({
    _id: 'users/Cody',
    name: 'Cody',
    title: 'Software Engineer'
  }))

  .then(() => jasql.create({
    _id: 'users/Brian',
    name: 'Brian',
    title: 'Quality Engineer'
  }))

  // next create 2 posts
  .then(() => jasql.create({
    _id: 'posts/Cody/' + new Date().toJSON(),
    title: 'How to use jasql',
    body: 'See documentation at http://github.chom/codyzu/jasql'
  }))

  .then(() => jasql.create({
    _id: 'posts/Cody/' + new Date().toJSON(),
    title: 'Why we may have to use relational databases',
    body: 'Often enterprises will want to leverage their existing infastructure, i.e. relational dbs.'
  }))

  // READ a document by id

  .then(() => jasql.read('users/Cody'))

  .then((doc) => console.log('User Cody:', doc))

  // LIST documents with wildcards

  .then(() => jasql.list({id: 'users/%'}))

  .then((docs) => console.log('All users:', docs))

  .then(() => jasql.list({_id: 'posts/Cody/%'}))

  // posts will be in chronological order
  // because they have the date in the id!
  .then((docs) => console.log('All posts by Cody:', docs))
```

# Roadmap

* implement missing db drivers
* add search functionality
* investigate improved indexing

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