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

timgit / pg-boss / 10016541428

20 Jul 2024 01:41AM UTC coverage: 93.17% (-6.8%) from 100.0%
10016541428

Pull #425

github

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

451 of 532 branches covered (84.77%)

357 of 381 new or added lines in 10 files covered. (93.7%)

40 existing lines in 5 files now uncovered.

873 of 937 relevant lines covered (93.17%)

805.36 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()
560✔
7

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

10
    this.config = config
560✔
11
  }
12

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

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

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

30
  async executeSql (text, values) {
31
    if (this.opened) {
26,816✔
32
      if (this.config.debug === true) {
26,815!
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)
26,815✔
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