All Projects → thewei → React Native Store

thewei / React Native Store

Licence: mit
A simple database base on react-native AsyncStorage.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Store

Go Sqlbuilder
A flexible and powerful SQL string builder library plus a zero-config ORM.
Stars: ✭ 539 (-5.11%)
Mutual labels:  database
Copycat
A novel implementation of the Raft consensus algorithm
Stars: ✭ 551 (-2.99%)
Mutual labels:  database
Quinedb
QuineDB is a quine that is also a key-value store.
Stars: ✭ 561 (-1.23%)
Mutual labels:  database
Lmdbjava
Lightning Memory Database (LMDB) for Java: a low latency, transactional, sorted, embedded, key-value store
Stars: ✭ 546 (-3.87%)
Mutual labels:  database
Flink Cdc Connectors
Change Data Capture (CDC) Connectors for Apache Flink
Stars: ✭ 546 (-3.87%)
Mutual labels:  database
Financedatabase
This is a database of 180.000+ symbols containing Equities, ETFs, Funds, Indices, Futures, Options, Currencies, Cryptocurrencies and Money Markets.
Stars: ✭ 554 (-2.46%)
Mutual labels:  database
Nitrite Java
Java embedded nosql document store
Stars: ✭ 538 (-5.28%)
Mutual labels:  database
Mongoui
MongoDB admin UI server written in Node.js 🎮
Stars: ✭ 566 (-0.35%)
Mutual labels:  database
Pickledb
pickleDB is an open source key-value store using Python's json module.
Stars: ✭ 549 (-3.35%)
Mutual labels:  database
Otj Pg Embedded
Java embedded PostgreSQL component for testing
Stars: ✭ 559 (-1.58%)
Mutual labels:  database
Entityauditbundle
Audit for Doctrine Entities
Stars: ✭ 546 (-3.87%)
Mutual labels:  database
Typeorm
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
Stars: ✭ 26,559 (+4575.88%)
Mutual labels:  database
Gin Boilerplate
The fastest way to deploy a restful api's with Gin Framework with a structured project that defaults to PostgreSQL database and JWT authentication middleware stored in Redis
Stars: ✭ 559 (-1.58%)
Mutual labels:  database
Imposm3
Imposm imports OpenStreetMap data into PostGIS
Stars: ✭ 542 (-4.58%)
Mutual labels:  database
Entityframework Reverse Poco Code First Generator
EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse engineered a database and lovingly created the code by hand. It is free to academics (you need a .edu or a .ac email address), not free for commercial use. Obtain your licence from
Stars: ✭ 562 (-1.06%)
Mutual labels:  database
Corfudb
A cluster consistency platform
Stars: ✭ 539 (-5.11%)
Mutual labels:  database
Jsonbase
A database software completely built as JSON files in backend. A powerful, portable and simple database works on top of JSON files. It is like a database software, currently having basic CRUD operation features. You can use this as a backend for your ReST APIs as well. The software is completely free and opensource. We are coming up with new features and providing more updates. The another beautiful advantage with JSON-base is since it is a NPM module, this fits well in your nodeJs applications eco system. if you want to develop quick prototypes/poc or need of a database with minimal requirements then, JSONBASe is an must option that you can consider. However there is a limitation if you go beyond a million records per table.
Stars: ✭ 552 (-2.82%)
Mutual labels:  database
Datasets For Recommender Systems
This is a repository of a topic-centric public data sources in high quality for Recommender Systems (RS)
Stars: ✭ 564 (-0.7%)
Mutual labels:  database
Clickhouse Driver
ClickHouse Python Driver with native interface support
Stars: ✭ 562 (-1.06%)
Mutual labels:  database
Yugabyte Db
The high-performance distributed SQL database for global, internet-scale apps.
Stars: ✭ 5,890 (+936.97%)
Mutual labels:  database

react-native-store

Build Status npm version NPM downloads

A simple database base on react-native AsyncStorage.

Installation

$ npm install react-native-store --save

Upgrading from previous version? Check for breaking-changes.

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

import Store from 'react-native-store';

const DB = {
    'foo': Store.model('foo'),
    'bar': Store.model('bar')
}

// somewhere inside react components

componentDidMount() {
    // Return all items
    DB.foo.find().then(resp => this.setState({items: resp}));
}

handleFilter(itemName) {
    DB.foo.find({
        where: {
            and: [{ foo: { neq: itemName } }, { age: { gte: 5 } }]
        },
        order: {
            age: 'ASC',
        }
    }).then(resp => this.setState({items: resp}));
}

handleOnPress() {
    DB.bar.add({
        foo: 'foo',
        bar: 'bar',
        age: 12
    });
}

Advanced Filtering

Filtering adds more advanced logic to queries. This implementation is heavily based off of LoopBack's implementation. However, there are some important things that are different/leftout:

  • The include filter is not implemented as it is not relevant.
  • The near and like/nlike operators are not implemented.
  • The skip filter in LoopBack is the offset filter in this implementation to stay consistent with previous versions.

Note: Query operations on object nested within an entry are not perfect. For example, trying to update an entry that looks something like this:

{
  location: { name: 'place', distance: 'far' }
}

With this as the value of a where filter:

{
  location: { name: 'place' }
}

Will overwrite the value of location, effectively removing the distance property. This occurs similarly with the order and fields filter, as you can only apply the filters to values that are not nested within an object.

Contributing

  • Fork this Repo first
  • Clone your Repo
  • Install dependencies by $ npm install
  • Checkout develop branch
  • Feel free to add your features
  • Make sure your features are fully tested
  • Publish your local branch, Open a pull request
  • Enjoy hacking <3
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].