mirror of
https://github.com/oven-sh/bun
synced 2026-02-17 06:12:08 +00:00
refactor(postgres) improve postgres code base (#20808)
Co-authored-by: cirospaciari <6379399+cirospaciari@users.noreply.github.com>
This commit is contained in:
23
src/sql/postgres/PostgresSQLContext.zig
Normal file
23
src/sql/postgres/PostgresSQLContext.zig
Normal file
@@ -0,0 +1,23 @@
|
||||
tcp: ?*uws.SocketContext = null,
|
||||
|
||||
onQueryResolveFn: JSC.Strong.Optional = .empty,
|
||||
onQueryRejectFn: JSC.Strong.Optional = .empty,
|
||||
|
||||
pub fn init(globalObject: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
|
||||
var ctx = &globalObject.bunVM().rareData().postgresql_context;
|
||||
ctx.onQueryResolveFn.set(globalObject, callframe.argument(0));
|
||||
ctx.onQueryRejectFn.set(globalObject, callframe.argument(1));
|
||||
|
||||
return .js_undefined;
|
||||
}
|
||||
|
||||
comptime {
|
||||
const js_init = JSC.toJSHostFn(init);
|
||||
@export(&js_init, .{ .name = "PostgresSQLContext__init" });
|
||||
}
|
||||
|
||||
// @sortImports
|
||||
|
||||
const bun = @import("bun");
|
||||
const JSC = bun.JSC;
|
||||
const uws = bun.uws;
|
||||
Reference in New Issue
Block a user