Skip to content

A simple JSON-based local database for Deno.

License

Notifications You must be signed in to change notification settings

jackfiszr/archisaurus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Archisaurus

A simple JSON-based local database for Deno

Usage

Import and initialization

import { createDb } from "https://deno.land/x/[email protected]/mod.ts";

const myDb = createDb();

Create db record

const myItem = {
  id: "my_id",
  val: "my_value",
};

myDb.createRecord(myItem);

id property is required.

Running your program

deno run --unstable --allow-read --allow-write my_program.ts

Define data model (optional)

To-do

Read db record

To-do

Update db record

To-do

Destroy db record

To-do

Delete database

with prompt for confirmation:

myDb.dropDb();

or delete immediately:

myDb.dropDb(true);

Customization

const myOptions = {
  dbDir: "my/nested/dir",
  pretty: 4, // saves db file in pretty format, number of spaces to indent
};

const customizedDb = createDb(myOptions);

Tests

deno test --unstable --allow-read --allow-write https://deno.land/x/[email protected]/test.ts

Licence

MIT