# lc-pg-dao

> postgres操作工具类。

Latest version **1.1.12** (published 2020-12-09) · 0 weekly downloads

## Install

```sh
npm install lc-pg-dao
pnpm add lc-pg-dao
yarn add lc-pg-dao
bun add lc-pg-dao
```

## 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.12 |
| Published | 2020-12-09 |
| First published | 2020-04-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 21.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Linc |
| Maintainers | sulirlin |
| Keywords | lc-js-common, winston-transport, pg, pg-pool |

## Links

- npm: https://www.npmjs.com/package/lc-pg-dao
- Repository: https://github.com/sulirlinc/lc-pg-dao
- Homepage: https://github.com/sulirlinc/lc-pg-dao#readme
- Issues: https://github.com/sulirlinc/lc-pg-dao/issues
- npm.io page: https://npm.io/package/lc-pg-dao

## Dependencies (7)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [pg](https://npm.io/package/pg.md) ^8.3.3
- [path](https://npm.io/package/path.md) ^0.12.7
- [pg-pool](https://npm.io/package/pg-pool.md) ^2.0.7
- [lc-js-common](https://npm.io/package/lc-js-common.md) latest
- [mybatis-mapper](https://npm.io/package/mybatis-mapper.md) ^0.6.5
- [winston-transport](https://npm.io/package/winston-transport.md) latest

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.1.12 (latest) — 2020-12-09
- 1.1.11 — 2020-09-21
- 1.1.10 — 2020-09-21
- 1.1.9 — 2020-09-18
- 1.1.8 — 2020-09-18
- 1.1.7 — 2020-09-18
- 1.1.6 — 2020-08-20
- 1.1.5 — 2020-08-19
- 1.1.4 — 2020-08-19
- 1.1.3 — 2020-08-19
- 1.1.2 — 2020-08-19
- 1.1.1 — 2020-08-19
- 1.1.0 — 2020-08-19
- 1.0.31 — 2020-08-18
- 1.0.30 — 2020-08-18
- … 29 more at https://npm.io/package/lc-pg-dao/versions

## README

# lc-pg-dao
postgres 数据库操作类。

## 使用方法

例如：

```javascript
const dao = require('lc-pg-dao')
const { assert } = require('chai');

  it("1.初始化", (done) => {
      const { client } = dao({
        config: {
          "user": "postgres",
          "password": "123123",
          "host": "127.0.0.1",
          "port": "5432",
          "database": "test"
        }
      })
      client().then(data => {
        console.log("初始化完成。")
        done()
      }).catch(e => console.error(e));
    }).timeout(120000)

  it("2.创建表", (done) => {
    dao({
      config: {
        "user": "postgres",
        "password": "123123",
        "host": "127.0.0.1",
        "port": "5432",
        "database": "test"
      }
    }).create({
      isAutoCreateId: true,
      tableName: 't_u_column',
      isAutoCreateOperatorId: true,
      fields: [ {
        name: 'key',
        type: 'varchar',
        isNotNull: true
      }, {
        name: 'type',
        type: 'varchar',
        isNotNull: true
      }
      ], uniqueKeys: [ 'code,key' ]
    }).then((data) => {
      console.log(data)
      done()
    }).catch(e => {
      console.error(e)
      done()
    })
  })
```

更多事例与覆盖请查看单元测试``test\test.js``

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