# turtlesoup

> event sourcing helper for rethinkDB

Latest version **1.0.6** (published 2016-12-27) · MIT license · 0 weekly downloads

## Install

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

## 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.0.6 |
| Published | 2016-12-27 |
| First published | 2016-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | monz |
| Maintainers | m-onz |
| Keywords | event, sourcing, event, sourced, rethinkDB |

## Links

- npm: https://www.npmjs.com/package/turtlesoup
- Repository: https://github.com/m-onz/turtlesoup
- Homepage: https://github.com/m-onz/turtlesoup#readme
- Issues: https://github.com/m-onz/turtlesoup/issues
- npm.io page: https://npm.io/package/turtlesoup

## Dependencies (3)

- [rethinkdb](https://npm.io/package/rethinkdb.md) ^2.3.3
- [pull-stream](https://npm.io/package/pull-stream.md) ^3.5.0
- [pull-pushable](https://npm.io/package/pull-pushable.md) ^2.0.1

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.6 (latest) — 2016-12-27
- 1.0.5 — 2016-12-27
- 1.0.4 — 2016-12-27
- 1.0.3 — 2016-12-27
- 1.0.2 — 2016-12-27
- 1.0.1 — 2016-12-27
- 1.0.0 — 2016-12-27

## README

# turtlesoup
Minimal Event Sourcing helper for RethinkDB &amp; node.js

[![Build Status](https://travis-ci.org/m-onz/turtlesoup.svg?branch=master)](https://travis-ci.org/m-onz/turtlesoup)

# install
```
npm install turtlesoup --save
```

# usage

```js
/*
// first create a db and table
var r = require('rethinkdb');
r.connect(function (err, conn) {
	r.create('demo').tableCreate('bucket').run(conn, function (){});
});
*/
var _turtlesoup = require('turtlesoup');
var turtlesoup = new _turtlesoup('demo', 'bucket'

setInterval(function () {

	turtlesoup.add({ demo: Math.random() * 11, timestamp: new Date() });

}, 1000);

pull(
	turtlesoup.get_all_latest(),
	pull.log()
)

```

# methods

## add
```js
turtlesoup.add({ demo: true, timestamp: new Date().toISOString() });
```

Add a new JSON object with mandatory timestamp field which needs to be a Javascript Date object.

## get_all
```js
turtlesoup.get_all(function (results) {
	console.log(results);
});

// or

turtlesoup.get_latest(function({ demo: true }, function (results) {
        console.log(results, 'filtered on demo property');
});

```

Returns an array of all items in the table.

## get_all_latest
```js
turtlesoup.get_all_latest(function (results) {
        console.log(results);
});

// or

turtlesoup.get_all_latest(function({ demo: true }, function (results) {
	console.log(results, 'filtered on demo property');
});

```

Returns an array of all the items in the table with the latest first.

## pull_all
```js
pull(
	turtlesoup.pull_all(),
	pull.log()
)

// or

	turtlesoup.pull_all({ demo: true }) // filter on demo === true

```

Get each data item from a pull stream source.

## pull_all_latest
```js
pull(
	turtlesoup.pull_all_latest(),
	pull.log()
)

//

	turtlesoup.pull_all_latest({ demo: true }) // filter on demo === true

```
Get each item from a pull stream source with the latest coming first.

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