updateC - Oppenjaimer/LbelDB.js GitHub Wiki

updateC(inx, col)

Update certain column in local memory. Missing array elements will default to an empty string.

Parameter Type Optional Default Description
inx number or string none Index or label of the column to update.
col Array or Object none New column data.

Returns: void

Example:

/*
dbs.lbel:
id
user
age
employed

dat.lbel:
10001
Jaime
28
false

10002
Matt
13
false

10003
Natasha
45
true
*/

const ldb = require("lbeldb");

ldb.retrieve(); // Labels: ["id", "user", "age", "employed"], Rows: [ ["10001", "Jaime", "28", "false"], ["10002", "Matt", "13", "false"], ["10003", "Natasha", "45", "true"] ]

ldb.updateC(1, ["numbers", 1, 2, 3]); // Labels: ["id", "user", "numbers", "employed"], Rows: [ ["10001", "Jaime", 1, "false"], ["10002", "Matt", 2, "false"], ["10003", "Natasha", 3, "true"] ]