0.2.0 • Published 5 years ago

rades-rave v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

rades-rave

A lightweight, non-schema, local database simulator

Build Status unstable

Installation

Using npm:

$ npm i -g rades-rave

Usage

//default instance
let rave = require('rades-rave').default
//or you can create a new instance
//const {Rave} = require('rades-rave')
//let rave = new Rave()

async () => {
	await rave.init({
		maxStorage: 1024 * 1000,
		syncInterval: 5 * 1000,
		dbroot: "/data/ravedb"
	})

	//single primary key
	await rave.insert("RaveTestDB", ["dbid"], [{
		"dbid" : 1,
		"data" : "anything"
	}])
	let datas = await rave.select("RaveTestDB", [1])

	//union primary key
	await rave.insert("RaveTestPlayerDB", ["playerId", "itemId"], [{
		"playerId" : 1,
		"itemId" : 1001,
		"data" : "anything"
	},{
		"playerId" : 1,
		"itemId" : 1002,
		"data" : "anything"
	}
	])
	datas = await rave.select("RaveTestPlayerDB", [1]) //=> Got two records
	datas = await rave.select("RaveTestPlayerDB", [1, 1002]) //=> Got one records
	await rave.delete("RaveTestPlayerDB", [1, 1002]) //Delete one.

	await rave.close()
}

Description

  • rades-rave is just use for quickly server development. Sometimes you don't really want to concern about the database detail.
  • rades-rave is worked well with rades solution. Learn More
  • rades-rave don't support really sql features, it's just a very very lightweight, simply simulation.
  • rades-rave is not a stand-alone service. No network, no configure, just require it and use.