jsodb
v0.3.0
Published
(It's actually JSONDB but that was already taken)
Downloads
7
Readme
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.