# gioneco-data-audit

> 针对mysql 到 clickhouse 数据同步做审计

Latest version **1.1.1** (published 2019-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install gioneco-data-audit
pnpm add gioneco-data-audit
yarn add gioneco-data-audit
bun add gioneco-data-audit
```

Provides the command `gioneco-data-audit`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-10-31 |
| First published | 2019-10-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 49.5 KB |
| Known vulnerabilities | 0 (+11 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | meiyun |
| Maintainers | meiyun123 |

## Links

- npm: https://www.npmjs.com/package/gioneco-data-audit
- Repository: https://github.com/yunmoon/gioneco-data-audit
- Homepage: https://github.com/yunmoon/gioneco-data-audit#readme
- Issues: https://github.com/yunmoon/gioneco-data-audit/issues
- npm.io page: https://npm.io/package/gioneco-data-audit

## Dependencies (7)

- [async](https://npm.io/package/async.md) ^3.1.0
- [yargs](https://npm.io/package/yargs.md) ^14.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [moment](https://npm.io/package/moment.md) ^2.24.0
- [mysql2](https://npm.io/package/mysql2.md) ^1.7.0
- [typeorm](https://npm.io/package/typeorm.md) ^0.2.19
- [@apla/clickhouse](https://npm.io/package/@apla/clickhouse.md) ^1.6.1

## Recent versions

- 1.1.1 (latest) — 2019-10-31
- 1.1.0 — 2019-10-31
- 1.0.9 — 2019-10-31
- 1.0.8 — 2019-10-29
- 1.0.7 — 2019-10-25
- 1.0.5 — 2019-10-21
- 1.0.4 — 2019-10-21
- 1.0.3 — 2019-10-21
- 1.0.2 — 2019-10-21
- 1.0.1 — 2019-10-21
- 1.0.0 — 2019-10-21

## README

## mysql同步数据到clickhouse数据审计工具

### 如何使用？
安装  
```bash
  npm install gioneco-data-audit
```
项目中使用

- 初始化数据表
``` bash
./node_modules/.bin/gioneco-data-audit init

```

- 怎么使用
```js
const AuditData = require("gioneco-data-audit").default;
let auditData = new AuditData({
  // mysql连接参数
  type: "mysql",
  host: "127.0.0.1",
  username: "root",
  password: "12345678",
  port: "3306",
  database: "ty_metro_trip",
  logging: true
}, {
  //clickhouse连接参数
  host: "10.255.50.45", port: "8123", user: "default", password: ""
}, {
  // mysql clickhouse数据表映射 orders为mysql数据表  t-real-data-order-pay-success为clickhouse数据表
  orders: "t-real-data-order-pay-success"
})
auditData.init().then(async _this => {
  const item = {
    orderNo: "212019101722200055499683",
    userId: "YVP0CXJG4M"
  }

  //同步数据到审计数据缓存表
  await _this.syncDataToAuditCache({
    uuid: item.orderNo,
    auditTable: "orders",
    uuidColumn: "orderNo",
    extra: JSON.stringify({
      userId: item.userId,
      orderType: 1
    })
  })
  // 执行数据审计任务，可以将方法放在定时任务内
  await _this.run({
    startTime: "2019-10-21 09:00:00",
    endTime: moment().format("YYYY-MM-DD HH:mm:ss"),
    auditTable: "orders"
  });
})
```

---
_Source: https://npm.io/package/gioneco-data-audit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
