1.2.2 • Published 5 years ago

hoopdb v1.2.2

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

HoopDB

HoopDB is a NoSQL database model made in node with no dependencies

Complete documentation can be found here

Getting started

$ mkdir my_awesome_project && cd my_awesome_project
$ mkdir db
$ npm install hoopdb

if you want to use it in other languages or maybe use an API: one is avaliable here

Create a .js file for exemple index.js

index.js
var path = require('path')
var hoopdb = require('hoopdb')

var db = new hoopdb(path.join(__dirname, 'db')) // path to your database

db.connect('token').then(() => { // This token will be used to encode a table when it's created and to decode one when it's loaded
    db.getTable('hello').then(table => { // Exemple get or create a table called 'hello'
        table.addLinePrimary({ // Adds a line once to your database, if this one exists, will do nothing
            name: "Naoufel Berrada",
            age: 18,
            mail: "contact@naoufel.space"
        })

        table.addLinePrimary({
            name: "Linus Torvalds",
            age: 49,
            mail: "linus@linux.org"
        })

        console.log('table data first time :\n', table.getData())

        table.updateLine({mail: "linus@naoufel.space"}, {name: "Linus Torvalds"}) // Updates mail at 'Linus Torvalds' line

        console.log('\ntable data second time :\n', table.getData()) // The data may have changed

        db.closeTable(table) // Save the table
    }, error => {
        console.error(error) // Print if there is an error when reading the table
    })
}, error => {
    console.log(error) // If you can't connect to the database
})

Notes

This project has been made in 4 hours (if we take out launch time and writing this readme). It may be obvious but don't use that database model in production. If there is any issue, notice me on the issue section, by mail at contact@naoufel.space or by discord Nowlow#4428.

Licence

MIT

1.2.2

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago