mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +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>
29 lines
1.0 KiB
Zig
29 lines
1.0 KiB
Zig
pub fn createBinding(globalObject: *jsc.JSGlobalObject) JSValue {
|
|
const binding = JSValue.createEmptyObjectWithNullPrototype(globalObject);
|
|
binding.put(globalObject, ZigString.static("MySQLConnection"), MySQLConnection.js.getConstructor(globalObject));
|
|
binding.put(globalObject, ZigString.static("init"), jsc.JSFunction.create(globalObject, "init", MySQLContext.init, 0, .{}));
|
|
binding.put(
|
|
globalObject,
|
|
ZigString.static("createQuery"),
|
|
jsc.JSFunction.create(globalObject, "createQuery", MySQLQuery.call, 6, .{}),
|
|
);
|
|
|
|
binding.put(
|
|
globalObject,
|
|
ZigString.static("createConnection"),
|
|
jsc.JSFunction.create(globalObject, "createQuery", MySQLConnection.call, 2, .{}),
|
|
);
|
|
|
|
return binding;
|
|
}
|
|
|
|
pub const MySQLConnection = @import("./mysql/MySQLConnection.zig");
|
|
pub const MySQLContext = @import("./mysql/MySQLContext.zig");
|
|
pub const MySQLQuery = @import("./mysql/MySQLQuery.zig");
|
|
|
|
const bun = @import("bun");
|
|
|
|
const jsc = bun.jsc;
|
|
const JSValue = jsc.JSValue;
|
|
const ZigString = jsc.ZigString;
|