mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 19:08:50 +00:00
### What does this PR do? Add MySQL support, Refactor will be in a followup PR ### How did you verify your code works? A lot of tests --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: cirospaciari <6379399+cirospaciari@users.noreply.github.com>
23 lines
636 B
Zig
23 lines
636 B
Zig
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!JSValue {
|
|
var ctx = &globalObject.bunVM().rareData().mysql_context;
|
|
ctx.onQueryResolveFn.set(globalObject, callframe.argument(0));
|
|
ctx.onQueryRejectFn.set(globalObject, callframe.argument(1));
|
|
|
|
return .js_undefined;
|
|
}
|
|
|
|
comptime {
|
|
@export(&JSC.toJSHostFn(init), .{ .name = "MySQLContext__init" });
|
|
}
|
|
|
|
const bun = @import("bun");
|
|
const uws = bun.uws;
|
|
|
|
const JSC = bun.jsc;
|
|
const JSValue = JSC.JSValue;
|