crud-json-array
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -8,2 +8,3 @@ "use strict"; | ||
const fs = require("fs"); | ||
const util_1 = require("util"); | ||
class Create { | ||
@@ -79,2 +80,11 @@ constructor() { | ||
} | ||
write_full_table_in_bulk(curTable) { | ||
// This method writes full table as array to file in one transaction | ||
if (util_1.isUndefined(curTable) || curTable.length == 0) { | ||
throw new Error("table array van not be empty"); | ||
} | ||
this.table = curTable; | ||
fs.writeFileSync(this.full_table_name, JSON.stringify({ "array": this.table })); | ||
this.read_table_from_file(); | ||
} | ||
get_table_full_path_name() { | ||
@@ -81,0 +91,0 @@ // returns this path and table name |
{ | ||
"name": "crud-json-array", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "This module is creating manipulating JSON array. That is create table, insert, update, select and delete. useful for small data", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# crud-json-array | ||
This module is creating manipulating JSON array. create table, insert, update, select and delete. useful for small data | ||
This module is for creating and manipulating JSON array, i.e create table, insert row, update row, select row and delete row. useful for small data like storing settings on servers | ||
@@ -7,18 +7,2 @@ ### install with this command | ||
## What is this module? | ||
This is storing small amount of data in columan and row format. for exmple storing settings, | ||
1. Each instance of this module produces only one table i.e table_name.json | ||
2. CRUD operatation inlude insert, update, find, delete | ||
## Format of table | ||
``` | ||
{ | ||
"array" : [ | ||
["Name", "Age", "Sex" ] //first row i.e 0 index is name of column | ||
,["Raju", 18, "Male"] | ||
,["Mangala", 34, "Female"] | ||
] | ||
} | ||
``` | ||
## reqiure this module | ||
@@ -44,2 +28,3 @@ ``` | ||
## Code to create more than one table | ||
Each instance of this module produces only one table i.e table_name.json | ||
``` | ||
@@ -60,2 +45,15 @@ //below exmple shows way to create three table in side folder data | ||
``` | ||
## Format of table | ||
``` | ||
{ | ||
"array" : [ | ||
["Name", "Age", "Sex" ] //first row i.e 0 index is name of column | ||
,["Raju", 18, "Male"] | ||
,["Mangala", 34, "Female"] | ||
] | ||
} | ||
``` | ||
## insert row | ||
@@ -82,7 +80,7 @@ ``` | ||
## read table (all) | ||
Two way to read | ||
Two ways to read | ||
1. from file `var tableFile = curDB.read_table_from_file();` | ||
2. from memory `var tableMemory = curDB.read_table_in_memory()` | ||
use in Momery as avoid from file method | ||
use in Momery method, avoid from file method | ||
@@ -92,2 +90,7 @@ ## get table name with path | ||
curDb.get_table_full_path_name(); | ||
``` | ||
``` | ||
## Write Full table in one bulk | ||
curDB.write_full_table_in_bulk(curTable)// curtable is array conataing | ||
``` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9739
134
92