-
Notifications
You must be signed in to change notification settings - Fork 0
Functions
lociDB has a lot of smart functions to help you set, get, insert and drop data.
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 an object on the last row use the function insert(tblName, object) instead.
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.
tblName - String of the table name eg. "users", "settings" etc.
Returns an array of objects that are found in the table. Returns false if the table doesn't exist or is empty.
tblName - String of the table name eg. "users", "settings" etc.
This will return how many rows there is in a table as a number. Returns false if no table exist or is empty.
Returns an array of all tables that are existing. Returns false if no tables are found.
tblName - String of the table name eg. "users", "settings" etc.
key - String of what key you wish to search for.
value - What value you want the key to have
This function will get all rows in a table matching key and a value as an array of objects.
Returns an array of objects if any matching is found. Returns false if no matching is found.
tblName - String of the table you want to delete rows in.
key - String of what key you wish to match the value
value - Value you want to match key.
Drop/delete specific rows in a table. Eg. dropRows("users", "name", "Mikael"); to drop/delete all users in a table that has a key name and the value is Mikael.
Returns a number of total rows deleted. Returns false if table doesn't exists.
tblName - String of the table you want to drop/delete.
Drop/Deletes a specific table. Returns false if the table doesn't exist. USE AT YOUR OWN RISK
Drop/Deletes all tables that are existing. USE AT YOUR OWN RISK Returns true if the delete was done or false if nothing was deleted.
License ISC Mikael Luxwarp Carlsson [email protected] https://codeiolo.org