0.0.9 • Published 9 years ago

featherdb v0.0.9

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

THIS PROJECT IS STILL IN PROGRESS AND NOT FOR USAGE!

Functionallity checklist (DEV)

  • Create if DB doesn't exists
  • Open DB if exists
  • Autohandler for creation or opening
  • Security limiter for evil actions
  • Put method
  • Remove method
  • Post method
  • Get method
  • Dump method
  • Filter for a 'find'-method
  • Kick-out read/writeJson methods for better performance and storage improvements

Installation

npm version Bower version Travis Build-State

FeatherDB supports the node package manager (NPM) and is located under janbiasi/featherdb. Alternately you can install the framework via bower. If you want the latest (not stable!) release, you can download a zip or tar archive from GitHub.

# installation via npm
npm install --save featherdb

# or via bower
bower install featherdb

Environement

You need at least Node.js in version 0.10 or above. If you want use io.js there's no problem, use any version of it. To install node, go to nodejs.org and press on install.

Debugging

Use the environement variable FDBDEBUG to enable the debug mode. All things form featherdb will be outputted cyan (logs and infos) or red (errors). You can set the environement variable within your systems cli like this;

# on windows
Set FDBDEBUG=true

# on mac and linux
export FDBDEBUG=true

Build- and Testing

Travis is used in this project as build and testing system.

Travis Build-State

Statuscodes

Code No.DescriptionModule
3Database has not been opened yet.featherdb:adapter

Database

The whole dataset is saved as JSON under the root path of executin in the store folder. Every database has some fixed properties set by the framework, containing the charset, settings, id, options, settings and a unique serial sha1 hash. Data put to the DB will be saved under the documents array with an id and a revision no. If you want to see a minimal database example take a look at the example featherdb.

Plugins

There is an NPM module which allows you to create custom plugins which interact with the database! If you want to create one, take a look at the section below.

List
NameAuthorDescriptionOfficial
feather-xml-exportJan BiasiExport Database to XMLYes
Write one
var FeatherPlugin = require('feather-plugin');
var MyPlugin = new FeatherPlugin(/* {} settings */);

MyPlugin.on('beforeRun', function() {
    console.log('Plugin will run now ...');
});

MyPlugin.create('my-plugin', function() {
    // Access the database via this.database
    return 1023;
});

MyPlugin.on('afterRun', function(result) {
    console.log('Result was %s', result);
});

exports = module.exports = MyPlugin;

Example

Below is an example application with a few actions inside. If you want to see more, please contact me. Update: New example and tutorial is coming soon!

var FeatherDB = require('featherdb');

var database = new FeatherDB('test-db', {
    adapter: 'featherDB'
});

database.on('ready', function(data) {
    console.log('Database %s is ready for work', data.name);
    var doc = database.put({
        hello: 'world',
        im: 'a test'
    }, 'myDocId', 1, function(err, props) {
        if(err) {
            console.error('Insert not possible (%s)', err.message);
        }
        database.get(props.id, function(err, doc) {
            if(err) {
                console.error(err.message); return;
            }
            console.log('This is my document: ' + doc);
        });
    });
});
0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago