Git Product home page Git Product logo

dropdb's Introduction

DropDB

A file-based db system for prototyping in Node Projects

This module provides a simple file based database using folders as tables and files are rows/entries. It is created as a drop-in db system for your prototypes and small personal projects. That being said, I tried keeping the logic close to known DB systems so swapping it out should be relatively easy

Usage

Note that only full entries are returned. There's no such thing as selecting certain fields. DropDB is a class, and*////////////////////////////////// needs to be required and instantiated:

const dropdb = require('dropdb');
const db = new dropdb(options);
db.get(table, key);

Configuration

The following object is the fallback object. By passing in an object in the constructor you can override them.

{
	folder: 'db',
}

Common Keywords

table: string
key: string
data: object

get(table, key)

Returns a single entry by its table and key

insert(table, key, data)

Insert a new entry, cannot update exsisting entries

update(table, key, data)

Update an entry, cannot insert new entries

query(table, query)

Returns an array of entries, currently limited to one table. The query variable expects an object as following:

{
	field: '', // Field name/key
	compare: '', // Comparitive action
	value: '' // Comparitive value
}

= | e | equals

Exact match

!= | !e | empty

Returns entries where the field isn't set or is set to undefined.

> | gt / >= | gte

Returns entries where the value in the field is higher.

< | lt / <= | lte

Returns entries where the value in the field is lower.

dropdb's People

Contributors

vandijkstef avatar

Watchers

James Cloos avatar  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.