• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

timgit / pg-boss / 10192012457

01 Aug 2024 04:27AM UTC coverage: 93.023% (-7.0%) from 100.0%
10192012457

Pull #425

github

web-flow
Merge de00c1a19 into f1c1636ca
Pull Request #425: v10

453 of 535 branches covered (84.67%)

381 of 407 new or added lines in 10 files covered. (93.61%)

40 existing lines in 5 files now uncovered.

880 of 946 relevant lines covered (93.02%)

877.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.19
/src/db.js
1
const EventEmitter = require('events')
4✔
2
const pg = require('pg')
4✔
3

4
class Db extends EventEmitter {
5
  constructor (config) {
6
    super()
562✔
7

8
    config.application_name = config.application_name || 'pgboss'
562✔
9

10
    this.config = config
562✔
11
  }
12

13
  events = {
562✔
14
    error: 'error'
15
  }
16

17
  async open () {
18
    this.pool = new pg.Pool(this.config)
562✔
19
    this.pool.on('error', error => this.emit('error', error))
562✔
20
    this.opened = true
562✔
21
  }
22

23
  async close () {
24
    if (!this.pool.ending) {
522!
25
      this.opened = false
522✔
26
      await this.pool.end()
522✔
27
    }
28
  }
29

30
  async executeSql (text, values) {
31
    if (this.opened) {
29,513✔
32
      if (this.config.debug === true) {
29,505!
NEW
33
        console.log(`${new Date().toISOString()}: DEBUG SQL`)
×
NEW
34
        console.log(text)
×
35

NEW
36
        if (values) {
×
NEW
37
          console.log(`${new Date().toISOString()}: DEBUG VALUES`)
×
NEW
38
          console.log(values)
×
39
        }
40
      }
41

42
      return await this.pool.query(text, values)
29,505✔
43
    }
44
  }
45
}
46

47
module.exports = Db
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc