github github

Introduction

HarperDB is a geo-distributed database with hybrid SQL & NoSQL functionality in one powerful tool, accessed via a REST API.
Runs anywhere presenting a single interface across all deployment architectures.

Meet Harpee

Harpee is a modeling tool for HarperDB, Harpee aims to simplify the use of HarperDB by letting you breakdown each table into a Model.

Installation & Usage

Harpee can be installed through npm or yarn.

npm i harpee or yarn add harpee

Harpee consists of the following function and classes.

Usage


   const harpee=require("harpee");
   
   const DB_CONFIG={host:'https://xxxxxxxxx.harperdbcloud.com' // or http:localhost:9925,
   username:'user',
   password:'pass',
   token:'ecyGuiofje93j.....' // only use token in place of username & password
   }
   
   // connects to your harperdb instance
   
   harpee.createConnection(DB_CONFIG);
   
   // create a schema
   
   const usersSchema= new harpee.Schema({name:'usersSchema',
   primaryKey:'user_id',
   silent:false,
   fields:{
   user_id:{type:String},
   age:{type:Number},
   joined:Date,
   name:String
   });
   
   // create a Model and pass the return value of Schema class
   // as a second argument.
   
   const myUsers= new harpee.Model('users',usersSchema);
   
   // Next, initialize it.
   // i recommend you get rid of this method after running you app atleast once.
   
   myUsers.init();
 
 
 

That's all, you can now perform several operations on the table with this Model.
Visit the Model's page for available methods.