Skip to content

Latest commit

 

History

History
97 lines (62 loc) · 1.9 KB

File metadata and controls

97 lines (62 loc) · 1.9 KB

Database

Database is the main interface in creating and manage a database for an application.

Methods:

Create database

A database can be created using the new operator:

const idb = new InlineDB(idbName);
Param Required Type Default Description
idbName Yes String None Name of the database to create

Throws

  • When idbName is not provided.
  • When idbName is not a string.
  • When idbName does not match [a-zA-Z0-9]+([-_][a-zA-Z0-9]+)* pattern.

Returns

An instance of Database.

Create table

Creates an instance of Table.

idb.createTable(tableName);
Param Required Type Default Description
tableName Yes String None Name of the table to create

Throws

  • When tableName is not provided.
  • When tableName is not a string.
  • When tableName does not match [a-zA-Z0-9]+([-_][a-zA-Z0-9]+)* pattern.

Returns

An instance of Table.

List tables

Lists table that are created so far in the database.

idb.listTables();

Returns

An array of table names (Array<String>).

Drop table

Deletes a table permanently.

idb.dropTable(tableName);
Param Required Type Default Description
tableName Yes String None Name of the table to drop

Returns

Current instance of Database.

Drop database

Deletes the database permanently.

idb.drop();

Returns

Nothing (undefined).