(sql: string, params: any[], method: any)
| 103 | }); |
| 104 | serverSimulator = new ServerSimulator(client); |
| 105 | const proxyHandler = async (sql: string, params: any[], method: any) => { |
| 106 | try { |
| 107 | const response = await serverSimulator.query(sql, params, method); |
| 108 | |
| 109 | if (response.error !== undefined) { |
| 110 | throw response.error; |
| 111 | } |
| 112 | |
| 113 | return { rows: response.data }; |
| 114 | } catch (e: any) { |
| 115 | console.error('Error from pg proxy server:', e.message); |
| 116 | throw e; |
| 117 | } |
| 118 | }; |
| 119 | db = proxyDrizzle(proxyHandler, { |
| 120 | logger: ENABLE_LOGGING, |
| 121 | }); |