Skip to content

Latest commit

 

History

History
205 lines (152 loc) · 4.72 KB

docs.md

File metadata and controls

205 lines (152 loc) · 4.72 KB

Full Documentation

Methods

Default

import QuipoDB from "quipodb";
const db = new QuipoDB(constructor);

Constructor

Option Type Default Value
path String ./databases/index.sqlite
inMemory Boolean false
provider Class SQLite

createCollection

Option Type Default Value
collectionName String index
primaryKey String NULL
cb Function (collection)=>{}

createDoc

Option Type Default Value
params document|document[] {}
cb Object[] (doc)=>{}

An key named ttl (Time-To-Live) will delete the document when the time is equal or greater than the current time.

deleteDoc

Option Type Default Value
fn Function (doc)=>{}
cb Function ()=>{}

findDoc

Option Type Default Value
fn Function (doc)=>{}
cb Function ()=>{}

hasDoc

Option Type Default Value
fn Function (doc)=>{}
cb Function ()=>{}

updateDoc

Option Type Default Value
params document {}
updateparams document {}
cb Object[] (this)=>{}

deleteColection

Option Type Default Value
collectionName String index
cb Function ()=>{}

getCollection

Option Type Default Value
fn Function (doc)=>{}
cb Function (document[])=>{}

Plugins

This lies on the class QuipoDB itself

import QuipoDB from "quipodb";
import yourPlugin from "your-plugin-package"; // Or a class
const db = new QuipoDB();
const plugin = new yourPlugin();
db.registerPlugin(plugin);

Your plugin must expose these functions

createCollectionProvider

Option Type
tableName String
primaryColumn string
dataType string

createColumnProvider

Option Type
tableName String
columnName string
dataType string

createDocProvider

Option Type
tableName String
data document
cb Function

deleteCollectionProvider

Option Type
tableName String
cb Function

deleteDocProvider

Option Type
tableName String
data document
cb Function

getDocProvider

Option Type
tableName String
data document
cb Function

getAllCollectionsProvider

Option Type
NULL NULL

getAllFromCollectionProvider

Option Type
tableName String

hasDocProvider

Option Type
tableName String
data document
cb Function

updateDocProvider

Option Type
tableName String
primaryColumn String
data document
cb Function

!!!primary Note Try to maintain the structure of the data when storing

interface document {
  [key: string]: string | number | Object | Array<any> | any;
}
interface storage {
  [collectioName: string]: document[];
}

!!!