Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/app-masters/realm-async-storage

Class for deal with Realm local DB similar to RN AsyncStorage
https://github.com/app-masters/realm-async-storage

Last synced: 8 days ago
JSON representation

Class for deal with Realm local DB similar to RN AsyncStorage

Awesome Lists containing this project

README

        

# Realm Async Storage
Class for deal with Realm local DB similar to RN AsyncStorage

### Usage
On the `App.js`, import and give desired model list to setup.
````javascript
import {RealmStorage} from 'realm-async-storage';
...
const schemas = [UserSchema, CompanySchema]; // Realm schemas
const onError = (error) => console.error(error); // optional
RealmStorage.setup(schemas, onError)

````

### Methods

- setup (schemas?: Array): any
- createItem (key: string, value: Object): Object
- updateItem (key: string, value: Object): Object
- deleteItem (item: RealmObject): Promise
- getItems (key: string, filter: Object | string): Promise | null>
- removeAll (key: string): Promise
- convertFilter (filter: Object | string): string
- checkSchema (key: string)
- getAllKeys (): Promise>
- getModel (): any

### Using
- [Realm-JS 2.18.0](https://github.com/realm/realm-js)