Skip to content

Functions

Mikael Carlsson edited this page Apr 14, 2017 · 12 revisions

lociDB has alot of smart functions to help you set, get, insert and drop data.

set(tblName, object)

tblName - String of the table name eg. "users", "settings" etc.

object - An object you wish to set to table, eg. var user = {name: "mikael", city: "Gothenburg", age: 17}

This function will overwrite any existing content in the table. If you want to insert and object on the last row use the function insert(tblName, object) instead.

Returns only an error as a string if something went wrong.

insert(tblName, object)

tblName - String of the table name eg. "users", "settings" etc.

object - An object you wish to set to table, eg. var user = {name: "mikael", city: "Gothenburg", age: 17}

This function will insert the object on the last row in the table. Will NOT overwrite any existing data.

Returns only an error as a string if something went wrong.

get(tblName)

tblName - String of the table name eg. "users", "settings" etc.

Returns an array of objects that is found in the table.

listTables()

Returns an array of all tables that are existing.

dropAll()

Deletes all tables that are existing. USE AT YOUR OWN RISK

Clone this wiki locally