<commit_before>## react-native-store [![Build Status](https://travis-ci.org/thewei/react-native-store.svg?branch=master)](https://travis-ci.org/thewei/react-native-store) ![NPM version](https://img.shields.io/npm/v/react-native-store.svg?style=flat) [![NPM downloads](http://img.shields.io/npm/dm/react-native-store.svg?style=flat-square)](https://npmjs.org/package/react-native-store)

A simple database base on react-native AsyncStorage.


### Installation
```bash
$ npm install react-native-store --save
```

***Upgrading from previous version?*** Check for [breaking-changes](breaking-changes.md).


### Data anatomy
```
db_store
   |---model_name
         |---totalrows (variable)
         |---autoinc (variable)
         |---rows (array)
                |--- _id (number)
                |--- ....

```

### API
- **Model( modelName )** : returns a `Model` object
- **Model.add( data, filter )** : returns a `promise` object
- **Model.update( data, filter )** : returns a `promise` object
- **Model.updateById( data, id )** : returns a `promise` object
- **Model.remove( filter )** : returns a `promise` object
- **Model.removeById( id )** : returns a `promise` object
- **Model.find( filter )** : returns a `promise` object
- **Model.findById( id )** : returns a `promise` object
- **Model.get( filter )** : returns a `promise` object
- **Model.destroy()** : returns a `promise` object

### Simple example

```js
var reactNativeStore = require('react-native-store');

var DB = {
    'foo': new reactNativeStore.model('foo'),
    'bar': new reactNativeStore.model('bar')
}

// somewhere inside react components

componentDidMount: function() {<commit_msg>Fixed a error<commit_after>## react-native-store [![Build Status](https://travis-ci.org/thewei/react-native-store.svg?branch=master)](https://travis-ci.org/thewei/react-native-store) ![NPM version](https://img.shields.io/npm/v/react-native-store.svg?style=flat) [![NPM downloads](http://img.shields.io/npm/dm/react-native-store.svg?style=flat-square)](https://npmjs.org/package/react-native-store)

A simple database base on react-native AsyncStorage.


### Installation
```bash
$ npm install react-native-store --save
```

***Upgrading from previous version?*** Check for [breaking-changes](breaking-changes.md).


### Data anatomy
```
db_store
   |---model_name
         |---totalrows (variable)
         |---autoinc (variable)
         |---rows (array)
                |--- _id (number)
                |--- ....

```

### API
- **Model( modelName )** : returns a `Model` object
- **Model.add( data, filter )** : returns a `promise` object
- **Model.update( data, filter )** : returns a `promise` object
- **Model.updateById( data, id )** : returns a `promise` object
- **Model.remove( filter )** : returns a `promise` object
- **Model.removeById( id )** : returns a `promise` object
- **Model.find( filter )** : returns a `promise` object
- **Model.findById( id )** : returns a `promise` object
- **Model.get( filter )** : returns a `promise` object
- **Model.destroy()** : returns a `promise` object

### Simple example

```js
var reactNativeStore = require('react-native-store');

var DB = {
    'foo': reactNativeStore.model('foo'),
    'bar': reactNativeStore.model('bar')
}

// somewhere inside react components

componentDidMount: function() {
{'fraction_non_alphanumeric': 0.19130959565479783, 'fraction_numerical': 0.0, 'mean_word_length': 3.6624472573839664, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6827718', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1046, 'n_words': 246}