refactor(postgres) improve postgres code base (#20808)

Co-authored-by: cirospaciari <6379399+cirospaciari@users.noreply.github.com>
This commit is contained in:
Ciro Spaciari
2025-07-07 18:41:01 -07:00
committed by GitHub
parent 19a855e02b
commit aa06455987
73 changed files with 5542 additions and 4995 deletions

View File

@@ -0,0 +1,25 @@
var file: std.fs.File = undefined;
pub var enabled = false;
pub var check = std.once(load);
pub fn load() void {
if (bun.getenvZAnyCase("BUN_POSTGRES_SOCKET_MONITOR_READER")) |monitor| {
enabled = true;
file = std.fs.cwd().createFile(monitor, .{ .truncate = true }) catch {
enabled = false;
return;
};
debug("duplicating reads to {s}", .{monitor});
}
}
pub fn write(data: []const u8) void {
file.writeAll(data) catch {};
}
const debug = bun.Output.scoped(.Postgres, false);
// @sortImports
const bun = @import("bun");
const std = @import("std");