jsodb

0.3.0 • Public • Published

JSODB

(It's actually JSONDB but that was already taken)

Key-Value Database puerly stored in json files.

jsodb.Database

constructor(path)

Path: File to write the database to.

GetByField(FieldName, Value)

Get Entry where the value of FieldName equals Value.

GetByFields(Fields)

Fields: { FieldName: Value }

Get Entry where every FieldName in Fields matches it's value.

GetById(Id)

Get Entry by Id.

Add(Entry)

Add Entry to Database.

Delete(Entry)

Delete Entry.

Update(Entry)

Update Entry.

Read(Overwrite)

Read Database from JSON file. If Overwrite is true, existing data in .Data will be overwritten.

Write(Overwrite, Pretty)

Write Database to JSON file. If Overwrite is true, existing JSON file will be overwritten. If Pretty is true, JSON will be formatted.

jsodb.Schema

constructor(Structure)

Create new Schema with Structure. Structure like:

{
	FieldName: Type
}

HasField(FieldName)

Return true if Schema has FieldName.

jsodb.Entry

constructor(Schema)

Create new Entry afer Schema.

Set(FieldName, Value)

Set FieldName to Value.

Get(FieldName)

Get Value of FieldName.

Readme

Keywords

Package Sidebar

Install

npm i jsodb

Weekly Downloads

1

Version

0.3.0

License

BSD-2-Clause

Last publish

Collaborators

  • beryju