TZJ5KFZ6XNQJFNDDMYGPURKC7JIC4E3DDB64T7D6PPC6YQRIJ6SQC
how: "add" || "remove" || "update"
data: row object || id to splice || {id: integer, property_that_has_changed: new_value, other_property_that_has_changed: new_value}
how: "replace" || "add" || "remove" || "update"
data: [row objects] || row object || id to splice || {id: integer, property_that_has_changed: new_value, other_property_that_has_changed: new_value}
pool.query(`select * from get_stores()`).then(r => {
for(let i = 0; i < r.rows.length; ++i) {
for(const prop in r.rows[i]) {
if(r.rows[i][prop] === null) {
delete r.rows[i][prop];
}
}
}
ws.subscribe('store');
ws.send(JSON.stringify({
what: 'store',
how: 'replace',
data: r.rows
}));
})