localStorage data provider and helpers for Rattus ORM
- LocalStorageDataProvider
Use your favorite package manager. For example, yarn:
yarn add @rattus-orm/core @rattus-orm/local-storage
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')
For detailed docs please read documentation website.
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct, and the process for submitting pull requests.