MCPcopy Create free account
hub / github.com/porsager/postgres / Query

Class Query

deno/src/query.js:6–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5export const CLOSE = {}
6export class Query extends Promise {
7 constructor(strings, args, handler, canceller, options = {}) {
8 let resolve
9 , reject
10
11 super((a, b) => {
12 resolve = a
13 reject = b
14 })
15
16 this.tagged = Array.isArray(strings.raw)
17 this.strings = strings
18 this.args = args
19 this.handler = handler
20 this.canceller = canceller
21 this.options = options
22
23 this.state = null
24 this.statement = null
25
26 this.resolve = x => (this.active = false, resolve(x))
27 this.reject = x => (this.active = false, reject(x))
28
29 this.active = false
30 this.cancelled = null
31 this.executed = false
32 this.signature = ''
33
34 this[originError] = this.handler.debug
35 ? new Error()
36 : this.tagged && cachedError(this.strings)
37 }
38
39 get origin() {
40 return (this.handler.debug
41 ? this[originError].stack
42 : this.tagged && originStackCache.has(this.strings)
43 ? originStackCache.get(this.strings)
44 : originStackCache.set(this.strings, this[originError].stack).get(this.strings)
45 ) || ''
46 }
47
48 static get [Symbol.species]() {
49 return Promise
50 }
51
52 cancel() {
53 return this.canceller && (this.canceller(this), this.canceller = null)
54 }
55
56 simple() {
57 this.options.simple = true
58 this.options.prepare = false
59 return this
60 }
61
62 async readable() {
63 this.simple()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected