Skip to content

Latest commit

 

History

History
84 lines (61 loc) · 1.24 KB

README.md

File metadata and controls

84 lines (61 loc) · 1.24 KB

doxor.js

logo
Offline database in Front-End
library for interacting with IndexedDB


Install Doxor.js using npm

npm i doxor.js

Creating a database

import Doxor from "doxor.js"


const dbName = new Doxor('dbName')

Specify the structure

const usersCollection = {
    name: 'users',
    indexes: [
        {
            key: 'name',
            unique: false
        },
        {
            key: 'email',
            unique: true
        }
    ]
}

dbName.Store(usersCollection)

name : Collection name
indexes [array of objects] : Each object carries collection field properties

result:

Insert Record

dbName.Insert('users',{name:"john",email:"[email protected]"})

Get Record

dbName.get('users',1,result => {
    console.log(result)
})

Get All Records

dbName.getAll('users',result => {
    console.log(result)
})

remove Record

dbName.remove('users',1)