MCPcopy
hub / github.com/drizzle-team/drizzle-orm / query

Method query

integration-tests/tests/pg/pg-proxy.test.ts:29–56  ·  view source on GitHub ↗
(sql: string, params: any[], method: 'all' | 'execute')

Source from the content-addressed store, hash-verified

27 }
28
29 async query(sql: string, params: any[], method: 'all' | 'execute') {
30 if (method === 'all') {
31 try {
32 const result = await this.db.query({
33 text: sql,
34 values: params,
35 rowMode: 'array',
36 });
37
38 return { data: result.rows as any };
39 } catch (e: any) {
40 return { error: e };
41 }
42 } else if (method === 'execute') {
43 try {
44 const result = await this.db.query({
45 text: sql,
46 values: params,
47 });
48
49 return { data: result.rows as any };
50 } catch (e: any) {
51 return { error: e };
52 }
53 } else {
54 return { error: 'Unknown method value' };
55 }
56 }
57
58 async migrations(queries: string[]) {
59 await this.db.query('BEGIN');

Callers 8

neon-ws.test.mjsFile · 0.45
node-pg.test.mjsFile · 0.45
vercel.test.mjsFile · 0.45
node-pg.test.cjsFile · 0.45
vercel.test.cjsFile · 0.45
neon-ws.test.cjsFile · 0.45
migrationsMethod · 0.45
proxyHandlerFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected