tableman
This package is used to deal with table structure data which retrieved from mysql or other databases.
table must has structure like:
var table = id: 1 num: 2 id: 2 num: 10 id: 3 num: 20;
methods
sum(table, options)
= : which field you wanna sum where Function: filter rows which you need
example:
tablemanshould;
count(table, options)
example:
tableman
join(table1, table2, options)
options Object = : 'field1' 'field2' or `function (a, b) {return a.sid === b.id}`
example:
// hign speedtableman// very slow speed, but flexibletableman
leftJoin(table1, table2, options)
the same as join
, but use left join strategy.
example:
tableman
group(table, options)
options Object = : group by this field : {} `rows` would be the rows which be grouped
example:
tableman
select(table, columns)
example:
tableman
order(table, columns)
example:
// order by sid asc, age desctableman
benchmark
Node.js version is: v1.6.3
length of `groupTable` is: 256
length of `table` is: 500
length of `otherTable` is: 500
#group x 2,665 ops/sec ±4.10% (82 runs sampled)
table join otherTable with array x 4,676 ops/sec ±4.57% (72 runs sampled)
table join otherTable with function x 307 ops/sec ±3.52% (76 runs sampled)