0.2.4 • Published 7 years ago

reasondb-wrapper v0.2.4

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Overview

This basic wrapper is designed to:

Setup

Run [sudo] npm install reasondb-wrapper --save

Setup with Redis

'use strict'

const RDBWrapper = require('reasondb-wrapper')

const db = new RDBWrapper({
  root:  './db',
  key: '@key',
  clear: false,
  active: true,
  redis: {enabled: true, port: 6379, host: '127.0.0.1', detect_buffers: true},
  async: true
})

Setup without Redis

'use strict'

const RDBWrapper = require('reasondb-wrapper')

const db = new RDBWrapper({
  root:  './db',
  key: '@key',
  clear: false,
  active: true,
  async: true
  // store: RDBWrapper.JSONBlockStore // Should pull list from reasondb
})

Inserting a record

class Person {
  constructor (name, birthday) {
    this.name = name
    this.birthday = birthday
  }
}

let person = new Person("Joe", new Date("1960-01-16"))

db.use(Person).post(person).then((response) => {
  console.log(response)
})

Getting records

class Person {
  constructor (name, birthday) {
    this.name = name
    this.birthday = birthday
  }
}


db.use(Person).get().then((response) => {
  console.log(response) //JSON results with metadata
})

Pagination and limiting records

class Person {
  constructor (name, birthday) {
    this.name = name
    this.birthday = birthday
  }
}


db.use(Person).page(1).limit(20).fields({name: 1}).get().then((response) => {
  console.log(response)
})

Roadmap

  • Connection configuration
  • Create DB directory and missing Primative directories
  • Cleans data
  • Ability to specify type of fallback
  • Ability to POST data
  • GET data
  • Paginate results
  • Specify fields to return
  • DELETE data
  • Metadata in results (part complete)
  • Optional document schema for nested Reference documents
  • Query builder (filter parameter)
0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago