# mekanika-adapter-memory

> Mekanika in-memory adapter

Latest version **0.1.0** (published 2014-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install mekanika-adapter-memory
pnpm add mekanika-adapter-memory
yarn add mekanika-adapter-memory
bun add mekanika-adapter-memory
```

## 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.1.0 |
| Published | 2014-07-28 |
| First published | 2014-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | cayuu |

## Links

- npm: https://www.npmjs.com/package/mekanika-adapter-memory
- Repository: https://github.com/mekanika/adapter-memory
- Issues: https://github.com/mekanika/adapter-memory/issues
- npm.io page: https://npm.io/package/mekanika-adapter-memory

## Recent versions

- 0.1.0 (latest) — 2014-07-28

## README

# adapter-fixture

[**Qe** (Query envelope)](https://github.com/mekanika/qe/) enabled in-memory adapter.

This adapter stores, updates and retrieves records from a memory store. It is **not intended for production**. Its primary use is for development testing as a fixture without requiring a backend.


## Usage

Pass a _Qe_ and a callback to `adapter.exec(qe, cb)`:

```js
var adapter = require('mekanika-adapter-fixture');

adapter.exec( {do:'find',on:'users'}, fn );
// Callback receives (error, results)
```

Override default `.id` identifier field name using:

```js
adapter.idField = '_id';
```


## Supported features

All reserved Query `do` actions are supported:

- 'create'
- 'find'
- 'update'
- 'remove'

Supports `.match` and the following match operators:

- eq, neq, in, nin, all, lt, lte, gt, gte

Supports `.populate`:

- by field name: `{ 'friends':{} }`
- with Qe: `{ 'friends': {query:{on:'users'}} }`
- on foreign key: `{'friends': {key: 'users_id'} }`

```js
{
  do:'find',
  on:'posts',
  populate:{
    'comments': {
      key:'cmt_id',
      query: {select: ['body']}
    }
  }
}
```

Supported `.update` reserved operators:

- **inc** - `{update: [ {score: {inc: 5}} ]}`
- **push** - `{update: [ {tags: {push:['cool']} ]}`
- **pull** - `{update: [ {tags: [pull:'removeme']} ]}`
- **unset** - `{update: [ {tags: {unset:true}} ]}`


Supports `.limit`, `.select`, `.offset` result filters:

```js
{
  do:'find',
  on:'posts',
  limit:5,
  offset:10,
  select:['-date']
}
```

Fixture Adapter uses `.id` as its identifier field.


## License

MIT

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