tilly:Tilly是一个简单的列式数据库,可以在浏览器或node.js的服务器端使用
- v4_792024了解作者
- 33.2KB文件大小
- zip文件格式
- 0收藏次数
- VIP专享资源类型
- 0下载次数
- 2022-06-10 22:12上传日期
蒂莉
Tilly是一个简单的列式数据库,可以在浏览器内或node.js的服务器端使用。存储每列的不重复值,并且行成为不重复值集合中的整数索引。
安装
在第一个发行版之前,请使用lib目录的内容,输入点是index.js 。下载后运行npm update以安装依赖项。
使用
有两种将数据添加到表中的主要方法:
动态创建Tables和Columns ,然后添加Rows 。
加载先前保存的数据的JSON文件。
然后,这两个选项都允许您查询表。
对于上面的选项2,提供了一个实用程序,可将CSV格式的数据转换为Tilly JSON格式。要运行此实用程序,只需调用以下命令:
node lib/tools/csv [source CSV path] [target JSON path]
然后使用以下命令压缩文件:
node lib/tools/compress [source JSON path]

tilly-master.zip
- tilly-master
- docs
- dist
- tilly.min.js3.7KB
- package.json659B
- LICENSE1.1KB
- package-lock.json3.8KB
- src
- core
- Query.ts1.7KB
- types.ts657B
- README.md610B
- Column.ts3.6KB
- operators.ts1.5KB
- index.ts180B
- Table.ts2.8KB
- tools
- csv.ts1.3KB
- README.md664B
- compress.ts1.2KB
- test
- dynamic.ts1.6KB
- file.ts1.9KB
- README.md339B
- between.ts673B
- README.md617B
- tsconfig.json5.9KB
- .gitignore72B
- webpack.config.js268B
- lib
- core
- Query.js1.7KB
- index.js964B
- Table.js2.9KB
- operators.d.ts1KB
- Table.d.ts1.9KB
- operators.js1.5KB
- Query.d.ts1.3KB
- Column.js3.4KB
- index.d.ts176B
- types.d.ts693B
- types.js77B
- Column.d.ts2.5KB
- tools
- compress.js1.4KB
- compress.d.ts11B
- csv.js1.4KB
- csv.d.ts11B
- test
- file.d.ts11B
- file.js1.9KB
- between.d.ts11B
- dynamic.js1.7KB
- dynamic.d.ts11B
- between.js774B
- README.md4KB
内容介绍
# Tilly
Tilly is a simple columnar database that can be used within the browser, or server-side in node.js. Stores the distinct values for each column and rows become integer indexes into the set of distinct values.
[](https://codeclimate.com/github/steelbreeze/tilly/maintainability)
## Installation
Until the first release, use the contents of the ```lib``` directory, the entery point is ```index.js```.
Run `npm update` after downloading to install dependencies.
## Use
There are two main ways to add data to a table:
1. Dynamically create ```Tables``` and ```Columns```, then add ```Rows```.
2. Load a JSON file of previously saved data.
Both options then allow you to query tables.
For option 2 above, a utility is provided to convert CSV formatted data into the Tilly JSON format. To run this utility, simply invoke the command:
```
node lib/tools/csv [source CSV path] [target JSON path]
```
Then compress the file with the following:
```
node lib/tools/compress [source JSON path] brotli
```
## Example
An example of option two would be:
```TypeScript
import { readFileSync } from 'fs';
import { brotliDecompressSync } from 'zlib';
import { Table, and, not } from '../core';
// read and uncompress source data
const json = JSON.parse(brotliDecompressSync(readFileSync(process.argv[2])).toString('utf-8'));
// load the database and table from file
const estimates = new Table(json);
// for conveniance, find the columns we are interested in; some aliased
const countryCode = estimates.columns.find(column => column.name === 'Country Code')!;
const countryName = estimates.columns.find(column => column.name === 'Country Name')!;
const indicatorName = estimates.columns.find(column => column.name === 'Indicator Name')!;
const value = estimates.columns.find(column => column.name === '2020')!.as('population').to(Number);
// a query to filter our country codes that are not countries
const countries = estimates.where(not(countryCode.in(['ARB', 'CSS', 'CEB', 'EAR', 'EAS', 'EAP', 'TEA', 'ECS', 'ECA', 'TEC', 'EUU', 'FCS', 'HPC', 'HIC', 'INX', 'LTE', 'EMU', 'LCN', 'LAC', 'TLA', 'LDC', 'LIC', 'LMY', 'LMC', 'MEA', 'MNA', 'TMN', 'MIC', 'NAC', 'OED', 'OSS', 'PSS', 'PST', 'PRE', 'SST', 'SAS', 'TSA', 'SSF', 'SSA', 'TSS', 'UMC', 'WLD'])));
// create a query to home in just on population data
const query = countries.where(and(indicatorName.equals('Population, total'), not(value.equals(null))));
// iterate the query results and display
for (const row of query.select(countryCode.as('code'), countryName.as('name'), value)) {
console.log(row);
}
// re-run the same query without the console overhead for timings
let count = 0;
const start = process.hrtime();
for (const row of query.select(countryCode.as('code'), countryName.as('name'), value)) {
count++;
}
const elapsed = process.hrtime(start);
console.log(`Returned ${count} rows from ${estimates.count()} in ${elapsed[0]}s ${elapsed[1] / 1000000}ms`);
```
The results of which is :
```
{ code: 'AFG', name: 'Afghanistan', population: 38928000 }
{ code: 'ALB', name: 'Albania', population: 2850000 }
...
{ code: 'ZMB', name: 'Zambia', population: 18384000 }
{ code: 'ZWE', name: 'Zimbabwe', population: 14863000 }
Returned 212 rows from 45325 in 0s 2.425424ms
```
This example uses population forecast data from the World Bank available [here](https://datacatalog.worldbank.org/dataset/health-nutrition-and-population-statistics). Performance based on a 2019 MacBook Pro 2.3GHz 8-core Intel Core i9.
## Licence
Licensed under the [MIT License](LICENSE).
## Depencencies
@steelbreeze/tilly depends on the following packages:
|Package|Use|Licence|
|:-|:-|:-|
|[csv-parser](https://github.com/mafintosh/csv-parser)|Stream parser for CSV files. Not a requirement for the core code, but used within the CSV to JSON conversion tool.|MIT License|
|[strip-bom-stream](https://github.com/sindresorhus/strip-bom-stream)|Removes byte order marks from files. Not a requirement for the core code, but used within the CSV to JSON conversion tool.|MIT License|
评论



相关推荐
- getting-started:Node.js入门!无论您是编程的新手,JavaScript的新手,从另一种语言迁移到Node.js还是对Node.js有所贡献,此存储库的目的都是让您立于不败之地。 导游 Node.js:常规 这些都是免费的高质量资源,任何人都应该可以使用它们立即...
- docker-node-legacy:使用 NodeSource Node.js 存储库为 Debian 和 Ubuntu 构建新镜像有 Node.js 0.10.30 到 Node.js 0.12.0 和 io.js 版本 1.3.0 到 io.js 1.5.1,可通过单独的标签获得。 迁移路径 步骤1。 确定您正在使用的 docker 容器中包含的节点版本,例如: $ docker run -it ...
- Node.js的源代码和解析缓存-Node.js开发Node.js的node-voo源缓存为执行的javascript文件创建v8缓存数据。 对一起使用的javascript文件进行分组。 (这些组称为“ Voo”。)将缓存文件存储到系统中。temp Director node-voo Node.js的源缓存为执行的...
- HelloNode:示例Node.js存储库Node.js Hello World 此示例演示了一个用于的小型Hello World node.js应用。 贡献 该项目采用了。 有关更多信息,请参见或与联系,并提出其他任何问题或意见。
- storytime-node:用于后台故事过程的node.js存储库storytime-node:用于后台故事过程的node.js存储库
- mininode:由Node.js创建的微型Node.js使用Node.js创建的Node.js使用Node.js创建的Node.js 印象深刻的是我挑战用Node.js制作迷你Node.js. ...初榨esprima ...抽象语法树(AST) ...执行加法 符的计算器...直到制作计算器和比较运算符的实现为止 变量...变量声明,赋值,参考 ....
- node.js-angular.js-boilerplate:Node.js和Angular.js的简单样板node.js-angular.js-样板 Node.js和Angular.js的简单样板 科技栈 单页Web应用程序是使用以下命令构建的: Node.js Angular.js 萨斯 Gulp.js 安装 确保已安装最新的Node.js并运行命令npm run setup ,它将执行以下...
- Node.js:Node.js练习和学习我在此存储库中使用了Node.js,Express.js,Socket.io和Mqtt.js和Mysql。 这里我们有: Node.js和Express.js基础使用Express.js和Socket.io的简单Mqtt客户端使用Express.js和Socket.io的简单聊天应用... 贡献 拉...
- node.js-Miriadax:miriadaX 平台上的 Node.js 课程在 unix 控制台中执行命令: node merge.js solucion.txt hello.txt que.txt tal.txt 检查文件 hello.txt que.txt tal.txt 的内容是否在新创建的文件 solution.txt 中。 该程序将目标文件中的源文件内容以如下形式...
- kndMappa:我的 node.js 存储库我的 node.js repo 用于此类实验性代码冒险,例如: deferred.js、promise.js、scribbles.js、kache.js、signals.js、clusterServer.js以及其他一些......它们都在我的 javascript 实验仓库中!!! deferred.js ...
最新资源