Skip to content

Latest commit

 

History

History

local-storage

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Rattus ORM

bundle size npm version (core)

Rattus ORM – Local Storage

localStorage data provider and helpers for Rattus ORM

Contents

  1. LocalStorageDataProvider

Installation

Use your favorite package manager. For example, yarn:

yarn add @rattus-orm/core @rattus-orm/local-storage

Basic usage

import { createDatabase, Model, Uid, Str } from '@rattus-orm/core'
import { LocalStorageDataProvider } from '@rattus-orm/local-storage'

class User extends Model {
  public static entity = 'user'
  
  @Uid()
  public id: string
  
  @Str()
  public email: string
}

const database = createDatabase({
  connection: 'entities',
  dataProvider: new LocalStorageDataProvider()
}).start()

const userRepo = database.getRepository(User)
userRepo.save([{ id: '1', email: '[email protected]' }, { id: '2', email: '[email protected]' }])

const found = userRepo.find('2')

Documentation

For detailed docs please read documentation website.

Contributing

Contributions are welcome! Please read our Contributing Guide for details on our code of conduct, and the process for submitting pull requests.