GithubHelp home page GithubHelp logo

drysque / hoopdb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nowlow/hoopdb

0.0 1.0 0.0 6 KB

NoSQL database model made in node all by myself in 4 hours with no dependencies

JavaScript 100.00%

hoopdb's Introduction

HoopDB

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

Getting started

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

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') // 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: "[email protected]"
    })

    table.addLinePrimary({
        name: "Linus Torvalds",
        age: 49,
        mail: "[email protected]"
    })

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

    table.updateLine({mail: "[email protected]"}, {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
})

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 [email protected] or by discord Nowlow#4428.

Licence

Idk how to get one but credit me

hoopdb's People

Contributors

drysque avatar nowlow avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.